-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: One-to-one, Many-to-one and db data inconsistency
PostPosted: Mon Jan 10, 2005 8:51 pm 
Beginner
Beginner

Joined: Wed May 05, 2004 12:45 pm
Posts: 21
Hibernate version:

Mapping documents:

<class name="Many" table="MANY">
<id name="id" type="long" unsaved-value="null">
<column name="ID" sql-type="NUMBER" not-null="true"/>
<generator class="assigned"/>
</id>
<component name="manyhasOne" class="ManyhasOne" insert="false" update="false">
<many-to-one name="One" class="One" cascade="all" column="ONE_FID" unique="true"/>
</component>
</class>

<class name="One" table="ONE" schema="NRVIS">
<id name="is" type="long" unsaved-value="null">
<column name="ID" sql-type="NUMBER" not-null="true"/>
<generator class="assigned"/>
</id>
</class>





Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:
net.sf.hibernate.UnresolvableObjectException: No row with the given identifier exists: 151164658


Name and version of the database you are using:

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


Hi,

In db I have two tables where a relationship amongst them is many-to-one. Many side corresponds to the parent. In the db there is a record on the many side but no corresponding record on the one side. Db doesn't have the actual fk but the fk logic is kept in meta data tables. I mapped it as a many-to-one relationship in the mappings. When I use retrieve if finds the record on the many side but throws an exception when trying to find record on the one side.

net.sf.hibernate.UnresolvableObjectException: No row with the given identifier exists: 151164658

Is it possible to specify in the mappings so that hibernate doesn't need the record on the 1 side. I can not specify the property in the where clause because i have a large tree and don't know where a problem might occur on what property.

Thank you very much


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 10, 2005 8:54 pm 
Beginner
Beginner

Joined: Wed May 05, 2004 12:45 pm
Posts: 21
I thought maybe i can make it one-to-one and that could work but when I took a look at documetation I saw that there are two ways to map one-to-one. In one case , the associated link between them is the pk in the parent and the child and the second way to map one-to-one is by mapping it many-to-one :)

Thanks for your help


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.