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: Need help extractring Criterion
PostPosted: Wed May 28, 2008 2:37 pm 
Newbie

Joined: Thu Apr 17, 2008 12:50 pm
Posts: 5
Hey everyone-

We are using the Criterion API as a method argument for a service. On the other end of the service we are adding the criterion to a session and executing the query.

However, prior to simply adding the criterion blindly to the session and executing the query, I would like to inspect the Criterion (such as get the param, value and the restriction) and make sure its valid.

Searched the docs and the API and can't find a clear way to do this. Does anyone have any ideas?

Thanks,

-Allon


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 28, 2008 4:31 pm 
Beginner
Beginner

Joined: Wed Mar 05, 2008 10:32 am
Posts: 48
The Criterian object has a toString method that will display part of what your looking for.
Just do a syserr out to console with the criteria object. I dont think this will give you your passed parameters, but it will give you your logic.

For the parameters just do a syserr for those values at that point.

You can also add some keys to your hibernate.cfg.xml file that will pretty print your sql as it's called.

Code:
      <!-- Echo all executed SQL to stdout -->
      <property name="show_sql">true</property>
   
      <!-- Pretty print SQL to log/console -->
      <property name="hibernate.format_sql">true</property>


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 28, 2008 5:06 pm 
Newbie

Joined: Thu Apr 17, 2008 12:50 pm
Posts: 5
Thanks, but that is not quite what I am looking for. I am not looking to see the SQL being executed, I am looking to parse the criteria before binding it to a session and calling it.

Anyone?

-Allon


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.