-->
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: JPQL: case & new statement
PostPosted: Tue Apr 16, 2013 3:04 pm 
Newbie

Joined: Tue Apr 16, 2013 2:48 pm
Posts: 2
Hi,

Is it possible to do something like:

SELECT CASE TYPE(v)
WHEN CarEntity THEN new test.CarBean(v.id)
ELSE new test.VehicleBean(v.id)
END
FROM VehicleEntity v

where I have two entities "VehicleEntity" and "CarEntity extends VehicleEntity"? CarBean and VehicleBean are to simple classes.

I currently do get a parser exception (near "THEN") from the QueryTranslaterImpl.parse(...). Returning either only the CarBean or the VehicleBean without any "CASE" work fine. Also returning only v.id within WHEN and ELSE (without the new) works fine. There also seems to be an issue when using different properties (like v.name and v.id in different WHEN/ELSE sections).

Thanks, Regards
Remo


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.