-->
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.  [ 4 posts ] 
Author Message
 Post subject: How to config many-to-one if maybe no key in parent table?
PostPosted: Thu Dec 11, 2003 10:59 pm 
Regular
Regular

Joined: Wed Dec 03, 2003 9:41 pm
Posts: 87
I have a parent table and a child table, but no foregin key exsit in database. So there are many records exist in child table but not in parent table. I config many-to-one in child table xml file. When I query data, hibernate2 throws Exception for reporting no key exist in parent table. What is the correct way to descible it in xml?
Exception :
net.sf.hibernate.UnresolvableObjectException: No row with the given identifier exists: 1007009, of class: com.bsteel.newbase.admin.marketdata.model.ProductTypeModel


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 12, 2003 8:29 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
You said that your data are corrupted (non existing parents referenced by children). You have to clean your DB.

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 14, 2004 5:04 am 
Regular
Regular

Joined: Wed Dec 03, 2003 9:41 pm
Posts: 87
In my system, no distinct foregin key exist in DB. User maybe insert corrupted record via my system. If it happens, system will crash when search these records. But there is many logic foregin key exist, include xxx.hbm.xml. So I check input data when user insert reocrds, I should select many parent tables for one record. System cannot accept the performance and system also have many enterance to insert records(It means I should change many functions to check foregin key).
So I need a simply way to ignore corrupted data when out-join search. Is it prossible now in h2?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 14, 2004 5:54 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
No. Hibernate assumes correct relational models.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.