-->
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: How to get the SQL string for a Criteria ?
PostPosted: Mon Feb 20, 2006 2:43 pm 
Newbie

Joined: Fri May 27, 2005 10:45 am
Posts: 6
Hi,

I'm building a Criteria using session.createCriteria(...);
I would like to be able to get the SQL string corresponding to this Criteria because I would like to be able to build a request like the following:

UPDATE ... FROM table WHERE field IN (criteria SQL string) SET ...

I've looked at the hibernate documentation but could not find anything.
Is it possible ?
Thanks
Patrick


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 20, 2006 3:15 pm 
Beginner
Beginner

Joined: Thu Jun 30, 2005 5:07 am
Posts: 33
you just have to add the following line in the hibernate-service.xml

<attribute name="ShowSqlEnabled">true</attribute>


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 20, 2006 3:19 pm 
Newbie

Joined: Fri May 27, 2005 10:45 am
Posts: 6
I was meaning: getting the SQL string corresponding to the Criteria dynamically... (to be able to reuse it in my update statement) not print it on the output.


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.