-->
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: JPA Criteria Subclass Join Using Metamodel
PostPosted: Tue Aug 17, 2010 11:25 am 
Beginner
Beginner

Joined: Wed Nov 21, 2007 10:24 am
Posts: 25
I'm trying to create a criteria query on a class that has several different subclasses that have foreign keys to other classes.

Value
Subclass Table1Value extends Value => Table1
Subclass Table2Value extends Value => Table2

So I have Value which is referenced by some class and I want to be able to get to Table1 by way of subclass Table1Value, but all I'm able to join is anything ? super Value. I want to get down to its subclasses and join off that. How can I do that using the JPA criteria api? I can do it through JPQL using value.table1Value and also doing a TYPE(value) IN (Table1Value) to make sure it's only going to do that type. However, I can't see a way to do this through the JPA criteria api which is my preferred way to do it since I can use the generated metamodel classes to make it typesafe.


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.