-->
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: createSQLQuery IN/UNION substitution 3.1rc3
PostPosted: Tue Dec 13, 2005 12:20 am 
Newbie

Joined: Tue Oct 25, 2005 12:32 pm
Posts: 13
Hibernate version: 3.1rc3

I'm new to Hibernate but I've searched the web / doc and found conflicting answers that I think are due to functionality change between versions of Hibernate.

I have a complicated query that requires an IN where the IN is evaluated against a UNION. That is :

select user from user where user.id in (SELECT id oneWay UNION SELECT id aSecondWay). The full sql seems irrelevant to my question.

createQuery doesn't support UNION in the current version of Hibernate so I thought I'd use createSQLQuery. However now I've lost the Hibernate replacement of Java names with SQL names. What I want Hibernate to do is to replace my Java class names with the actual database tablenames, column names. I can do an addEntity call but that just maps the class that I'm selecting. I want it to parse the whole string. I noticed that there really isn't an example of this in the Hibernate unit tests - almost all the createSQLQuery tests are very simple one table selects. so I'm assuming that I'm just trying to make it do something that it can't. It appears that this functionality is available in the classic Session but was removed in the newer version. Is that correct? Should I just use JDBC in this case?

In addition: I found that there is a feature request to add UNION support to createQuery. Is anyone aware of a timeframe for this?

Thank you.


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.