-->
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: .hbm.xml config overriden by criteria queries?
PostPosted: Thu Jul 08, 2010 10:03 am 
Newbie

Joined: Thu Jan 24, 2008 12:24 pm
Posts: 5
Hi All,
I have a Parent, Child relationship with the following configuration (please do not worry about typo mistakes)
<class name="Parent">
<id column="parent_id" name="identity" type="java.lang.Long">
<generator class="sequence">

</generator>
</id>
<property name="created" type="java.util.Date" />
<set name="childSet" lazy="false" inverse="true" fetch="subselect" >
<key column="parent_id" />
<one-to-many class="Parent" />
</set>
</class>

<class name="Child">
<id column="child_id" name="identity" type="java.lang.Long">
<generator class="sequence">

</generator>
</id>
<property name="created" type="java.util.Date" />
<many-to-one name="parent" column="parent_id"
class="Parent" />
</class>

Please note i have lazy="false" inverse="true" fetch="subselect" in the Parent configuration.

If i use a criteria like this
Criteria crit = session.createCriteria(Parent.class);
crit..createCriteria("childSet");

Will this query overrides the above configuration mentioned in Parent.hbm.xml file (ie lazy="false" and fetch="subselect")

Also if i use a criteria like this
Criteria crit = session.createCriteria(Parent.class).setFetchMode("childSet",FetchMode.JOIN);

Will this query overrides the above configuration mentioned in Parent.hbm.xml file (ie lazy="false" and fetch="subselect").

If the above two criterias will not override the .hbm.xml configuration, can someone specify in which way can i override?

Thanks in advance.


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.