-->
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.  [ 5 posts ] 
Author Message
 Post subject: transforming criteria to sql
PostPosted: Mon Apr 14, 2008 6:11 pm 
Newbie

Joined: Sun Mar 30, 2008 10:15 pm
Posts: 18
Hello,

Is there a way for me to turn a criteria to any one of these formats:
* hibernate hql.
* hibernate org.hibernate.Query
* sql

Any one of these would do...

I want to use of the formats above and change the query then submit it to the db.

For example I'd like to do something like this

String sql = "SELECT COUNT(*) FROM (" + transformCriteria(myCriteria) + ")"

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 14, 2008 11:18 pm 
Beginner
Beginner

Joined: Wed Mar 05, 2008 4:57 am
Posts: 22
Location: Bangalore,India
Not clear with ur question. Can you please elaborate.

_________________
Naresh Waswani
+91-9986461501


Top
 Profile  
 
 Post subject: Don't think so
PostPosted: Tue Apr 15, 2008 10:16 am 
Newbie

Joined: Tue Oct 10, 2006 3:27 pm
Posts: 4
As far as I am aware there is no way to do what you want. I know there is no way to convert criteria to HQL and vice versa. A co-worker of mine and I had a lengthy discussion about how convenient that would be. It might be possible with SQL, but as I said, I don't think so.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 16, 2008 10:52 am 
Newbie

Joined: Sun Mar 30, 2008 10:15 pm
Posts: 18
Sure, let me clarify:
I'm constructing a complicated criteria, and I'd like to convert it to a sql or hql string.

Then I'd like to manipulate the string and submit the query to the db for execution.

Schevus - is there a way to turn it to sql? sounds like you're saying no way to turn it to hql.

Thanks again!


Top
 Profile  
 
 Post subject: Doesn't Look Good
PostPosted: Wed Apr 16, 2008 5:13 pm 
Newbie

Joined: Tue Oct 10, 2006 3:27 pm
Posts: 4
I'm not seeing any provided API that allows you to change it to SQL. You can put SQL into criteria, but it doesn't look like you can get SQL out of criteria (without writing your own code to do so obviously). Good luck!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.