-->
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: StatelessSession join fetch does not work for many-to-one.
PostPosted: Tue Feb 14, 2006 4:18 pm 
Newbie

Joined: Thu Aug 04, 2005 3:50 pm
Posts: 5
I am trying to use the new StatelessSession.

When using hql and a join fetch from parent to child, both the parent and child are fully initialized.

However, when using hql and a join fetch from child to parent, the child is initialized, but the parent remains a Proxy.

It appears that the hql is not overriding the default lazy="proxy" setting in the many-to-one mapping when using StatelessSession. It does work as expected when using Session.

Regards,

Gregg


Hibernate version:

3.1.2


Mapping documents:

Code:
<set name="Children" table="Child" inverse="true" cascade="all">
     <key column="ParentFK"/>
     <one-to-many class="Child"/>
</set>

<many-to-one  name="Parent" column="ParentFK" class="Parent" cascade="none"/>



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

Code:
String hql1 = "select parent from Parent parent join fetch parent.Children";

List results1 = MyStatelessSession.executeHQL(hql1);

// Results will have parent and children fully initialized


String hql2 = "select child from Child child join fetch child.Parent"

List results2 = MyStatelessSession.executeHQL(hql2);

// Results will have child fully initialized but parent is a Proxy.


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.