Beginner |
|
Joined: Sun Nov 07, 2004 4:19 pm Posts: 38
|
[b]Hibernate version:[/b]
2.1.6
[b]Mapping documents:[/b]
<class name="User"...>
<many-to-one cascade="all" name="address" class="Address" unique="true">
<column name="ADDRESS_OID" />
</many-to-one>
</class>
<class name="Address" table="ADDRESS" lazy="true" dynamic-update="true" >
<id name="id" type="long" column="ADDRESS_OID" unsaved-value="0" >
<generator class="native">
<param name="sequence">ADDRESS_SEQ</param>
</generator>
</id>
<version name="version" type="integer" column="VERSION" unsaved-value="undefined"/>
<property name="type" type="int" column="TYPE"/>
<property name="address" type="java.lang.String" column="ADDRESS"/>
<property name="city" type="java.lang.String" column="CITY"/>
<property name="county" type="java.lang.String" column="COUNTY"/>
<property name="state" type="java.lang.String" column="STATE"/>
<property name="zip" type="int" column="ZIP"/>
</class>
If attribute lazy is set to "false" for Address then if I do address.getId() then it returns its valid oid. However, if it is set to true then getId returns 0. All other fields return the correct values.
What is my problem here?
Dino
|
|