-->
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: Criteria Joining Association Problem
PostPosted: Fri Feb 22, 2008 5:29 pm 
Newbie

Joined: Mon Mar 05, 2007 12:01 pm
Posts: 3
I am testing the criteria for narrowing collection items being loaded.

Entity A has a collection of entity Bs. There are 2 ways references between A and B. The fetch type is LAZY for both relationships.

In my loading code, I have the following criteria defined:

Code:
Criteria criteria = getHibernateTemplate().getSessionFactory().getCurrentSession().createCriteria(EntityA.class)
         .add(Restrictions.eq("id", primaryKey))
         .createCriteria("entityBs")
            .add(Restrictions.eq("state", 1));
      List<EntityA> entityAs = criteria.list();


Hibernate loads correct EntityA but it does not load any EntityBs.

I run the generated query and it does return values for both EntityA and EntityB.

Anyone knows what the problem is?


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.