-->
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.  [ 3 posts ] 
Author Message
 Post subject: Criteria: is there any way to get the SQL stmt?
PostPosted: Thu Aug 24, 2006 8:41 am 
Newbie

Joined: Thu May 04, 2006 5:04 am
Posts: 17
Location: Austria
Hi everybody,
I need the SQL statement which would be executed by the criteria without actually executing it (like the Hibernate SQL debug).
Due to the fact that the Criteria Interface is quite write-only, only one get method I think, I see no obvious approach to retrieve the SQL statement from a given Criteria object.
There is nothing in my Hibernate books about this and even asking the great Google didn't help. The same goes for the Hibernate JavaDoc and Reference.

Any help would be greatly appreciated.
kind regards, Chris

_________________
Please don't forget to rate the posting if it helped you, thanks


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 24, 2006 10:55 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
You can't, unless you want to reproduce a lot of internal hibernate code. If you really, really have to do this, see if you can figure out how to reproduce the functionality of org.hibernate.loader.criteria.CriteriaQueryTranslator.getSelect(). You should have access to everything you need, given your Criteria and Session objects, but you'll have to cast to a lot of hiberante impls. Nasty stuff.

_________________
Code tags are your friend. Know them and use them.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 25, 2006 8:50 am 
Newbie

Joined: Thu May 04, 2006 5:04 am
Posts: 17
Location: Austria
Hi tenwit,
thanks for your response.
The root of all evil is bug HH-1425 http://opensource.atlassian.com/projects/hibernate/browse/HHH-1425
.
Without this bug I could solve my problem without tampering with the guts of the Criteria API.
Unfortunately the bug is still unassigned after 6 months (but at least classified as major).

kind regards, Chris

_________________
Please don't forget to rate the posting if it helped you, thanks


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

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.