-->
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
PostPosted: Tue Jul 24, 2007 6:52 pm 
Newbie

Joined: Tue Jul 24, 2007 6:48 pm
Posts: 4
Given a criteria, is there an API to generate SQL string ? I would like to do a delete given a criterial. I understand that session has a delete API that I can pass SQL string. But that would force me to construct the SQL in the outer layer.


Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 24, 2007 7:29 pm 
Regular
Regular

Joined: Fri Jan 27, 2006 2:32 pm
Posts: 102
Location: California, USA
Could you use a criteria search to find the object, and then pass the object to the session's Delete method?

Basically, use the
Code:
ISession.Delete(object)
method.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 25, 2007 10:11 am 
Newbie

Joined: Tue Jul 24, 2007 6:48 pm
Posts: 4
The problem is that

1) each object has to be constructed. Therefore all fields must be mapped.
2) I have to iterate each object.

The above 2 reasons would have some performance hit. If I were to constuct the sql statement, then it would be better.

BTW, I believe I can get the where clause since criteria's ToString return the condition. So, I am trying to find out how to get the table name from the criteria ??


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.