-->
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.  [ 2 posts ] 
Author Message
 Post subject: What is difference on setParameter() verses setTime()...
PostPosted: Wed Feb 07, 2007 4:18 pm 
Newbie

Joined: Wed Mar 30, 2005 12:10 pm
Posts: 3
Location: Omaha, NE
Suppose you have the following:

Code:
Date lDate = new Date();
Query lQuery = lSession.createQuery("from table a where a.time < :pTime");
lQuery.setParameter("pTime", lDate);


What is difference between this code using setTime...

Code:
Date lDate = new Date();
Query lQuery = lSession.createQuery("from table a where a.time < :pTime");
lQuery.setTime("pTime", lDate);


Looking for an actual reason instead of personal preference...

Thanks, Michael


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 07, 2007 4:56 pm 
Senior
Senior

Joined: Sat Aug 19, 2006 6:31 pm
Posts: 139
Hi,
Here's a snippet from the hibernate javadoc for Query.setParameter
Quote:
Bind a value to a JDBC-style query parameter. The Hibernate type of the parameter is first detected via the usage/position in the query and if not sufficient secondly guessed from the class of the given object.


Looks like internally, hibernate has to do more work to determine the actual type of the object.

Using setTime() hibernate knows the type and does not need to determine it.

Budyanto


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