-->
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: Fetches using CriteriaBuilder
PostPosted: Fri Apr 08, 2011 10:52 am 
Newbie

Joined: Fri Apr 08, 2011 4:28 am
Posts: 2
I am trying to create a query using the JPA CriteriaBuilder.
I have set up my root and want to create a Left Fetch Join.

I have followed as per the entity Manager documentation
http://docs.jboss.org/hibernate/entitym ... from-fetch

My code looks like the following

Code:
      final CriteriaBuilder builder = entityManager.getCriteriaBuilder();
      final CriteriaQuery<Entity> criteria = builder.createQuery(Entity.class);
      final Root<Entity> entity= criteria.from(Entityt.class);
      final Join<Entity,Entity2> entities = entity.fetch(Entity_.moreEntities, JoinType.LEFT);



The problem I have is the entity.fetch doesn't return a Join object but a Fetch object.
The Fetch object you can't do a .get method on and I want to be able to so I can add a where clause on query a joined column.

The documentation says .fetch does pass back a Join object.
Is the documentation wrong or am I doing it wrong?


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.