Hi
I have 2 tables in the schema, say User and Address, where User has addessID in the table.
The user can have none or multiple addessess.
I am using many-to-one relation in the Address class as follows:
<many-to-one
name="user"
class="User"
cascade="none"
outer-join="auto"
update="true"
insert="true"
access="property"
column="ADDRESSID"
unique="true"
/>
But when I am running the test, it runs successfully if there is a corresponding addressID in the User table, but throws the following error if there is no corresponding addressID in the User table:
[junit] No row with the given identifier exists: 0, of class: User; nested exception is net.sf.hibernate.UnresolvableObjectException: No row with the given identifier exists: 0, of class: User
[junit] org.springframework.orm.hibernate.HibernateObjectRetrievalFailureException: No row with the given identifier exists: 0, of class: User; nested exception is net.sf.hibernate.UnresolvableObjectException: No row with the given identifier exists: 0, of class: User
Any suggestions on what may be the solution for this, would appreciate ay help.
Thank you
|