-->
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.  [ 1 post ] 
Author Message
 Post subject: Entity classes having self reference
PostPosted: Mon Mar 28, 2005 11:08 am 
Newbie

Joined: Tue Feb 01, 2005 8:18 am
Posts: 8
Read the rules before posting!
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:


Mapping documents:
<table class="A.B.C" table="item">
<id name="id" column="item_id">
<generator class="identity">
</id>
<many-to-one name="parent" column="parent_id" class="A.B.C">
</table>

As seen from the above mapping , "parent" property of the "A.B.C." class is pointing to "A.B.C" (to self) . In this case , when HQL query is fired for one "A.B.C",
whether hibernate tries to fetch all the "parent" objects until it gets null or
what is it's behaviour in this case ?
i.e. item_id prent_id
1
2 1
3 2

So here in this case will it fetch three "A.B.C" objects when HQL query
"from C obj1 where obj1.id = 1" is fired


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

Full stack trace of any exception that occurs:

Name and version of the database you are using:

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


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

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.