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.
|
|