-->
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 restrict column list in select
PostPosted: Thu Aug 18, 2011 11:05 am 
Newbie

Joined: Tue Nov 15, 2005 2:14 am
Posts: 7
I have a Simple class hierarchy (with InheritanceType.JOINED strategy):
C extends B extends A

In a select using jpql I want to retrieve only the "A part" of my data.

I try the following query but it always returns complete C object

select object FROM A object WHERE TYPE(object) = A

I also try the TYPE function but it act as a filter instead an filter the database to return only A object.
In my case it return 0record because all my objects in the table are of C type.

The generated sql contains this kind of "CASE" instruction:
case when C.databaseId is not null then 2 when B.databaseId is not null then 1 when A.databaseId is not null then 0 end=0

Does jpa support this kind of functionnality?
Am I doing something 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.