-->
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: Can recursive classes be defined
PostPosted: Sat Apr 08, 2006 8:34 pm 
Newbie

Joined: Fri Apr 07, 2006 6:04 pm
Posts: 12
Hibernate version:
3.1

Name and version of the database you are using:
MySQL -- Innodb



I've been trying to create a somewhat compicated class but so far I am unsuccessful.

For simplicity, I will describe it thus:

Class A has a bunch of property items and a list which references class B. Class B has a bunch of property items and subclasses. Some of the subclasses have a list of B referenced (thus self referencial or recursive). With some twiddling I was able to get hibernate to not complain but at run time it stopped indicating that a foreign key condition had failed. I interpreted this as meaning that the list in the subclasses was being created before the list item in B.

My questionis whether this is possible at all. If not, what solutions may exist.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 10, 2006 1:06 am 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
It is possible. You just have to be careful with your mappings. The most common pitfall is to omit the not-null="true" atttribute of the <key> element in the collection definition, but there are other potential traps. Post specific problems that you're having.


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.