Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

Hibernate Association

 
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Hi

1. In hibernate orm concepts are seems like similar to the database relational linking, where as what is the advantage of having orm because we have the database relational technique so why would i need to go for orm

2. in hibernat association for many to one like user_master table user id have lot of expense id in expense_master table and i have done all mapping like i pasted the code below so my question is

while i am fetching the user i can get all expense detals but while inserting the expense, shall i need load the user in expense pojo ? same when i inser user do i need to set any expense objects?

if any links or words to explain association please let me know it bit confusing

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated Aug 19, 2009 8:17:22 AM by Hibernate Tools 3.2.4.GA -->
<hibernate-mapping>
<class name="ZuserDetail" table="zUSER_DETAIL" schema="dbo" catalog="EMONITERING">
<id name="userId" type="int">
<column name="USER_ID" />
<generator class="assigned" />
</id>
<property name="username" type="string">
<column name="USERNAME" length="500" />
</property>
<property name="password" type="string">
<column name="PASSWORD" length="2000" />
</property>
<property name="dob" type="timestamp">
<column name="DOB" length="23" />
</property>
<property name="email" type="string">
<column name="EMAIL" length="200" />
</property>
<property name="paddress" type="string">
<column name="PADDRESS" length="1000" />
</property>
<property name="caddress" type="string">
<column name="CADDRESS" length="1000" />
</property>
<property name="status" type="java.lang.Character">
<column name="STATUS" length="1" />
</property>
<property name="createTimeStamp" type="timestamp">
<column name="CREATE_TIME_STAMP" length="23" />
</property>
<set name="loginDatas" inverse="true" lazy="true" table="LOGIN_DATA" fetch="select">
<key>
<column name="USER_ID" />
</key>
<one-to-many class="LoginData" />
</set>
</class>
</hibernate-mapping>
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated Aug 19, 2009 8:17:22 AM by Hibernate Tools 3.2.4.GA -->
<hibernate-mapping>
<class name="LoginData" table="LOGIN_DATA" schema="dbo" catalog="EMONITERING">
<id name="loginTypeId" type="int">
<column name="LOGIN_TYPE_ID" />
<generator class="assigned" />
</id>
<many-to-one name="zuserDetail" class="ZuserDetail" fetch="select">
<column name="USER_ID" />
</many-to-one>
<property name="loginType" type="string">
<column name="LOGIN_TYPE" length="50" />
</property>
<property name="username" type="string">
<column name="USERNAME" length="50" />
</property>
<property name="password" type="binary">
<column name="PASSWORD" />
</property>
<property name="status" type="java.lang.Character">
<column name="STATUS" length="1" />
</property>
<property name="createdTimeStamp" type="timestamp">
<column name="CREATED_TIME_STAMP" length="23" />
</property>
</class>
</hibernate-mapping>
 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Your original thread has been moved to https://coderanch.com/t/458890/Object-Relational-Mapping/java/Hibernate-insert
Let us continue the discussion there.
 
permaculture is giving a gift to your future self. After reading this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
    Bookmark Topic Watch Topic
  • New Topic