-->
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: how to use setParamter() to set date ?
PostPosted: Thu Jun 23, 2005 2:09 am 
Newbie

Joined: Tue Jun 21, 2005 6:18 am
Posts: 4
Location: Kerala-India
hi

this is my query:
delete from Accessed as acc where acc.userid=:user_id and acc.dat=:min_date

how should i set the parameter "min_date" using the setParameter method ?

mindate contains the date object to be set in the query.

what change should i make to the below stated code to work correctly?
query2.setParameter("min_date", mindate, Hibernate.DATE);


this is only my second request to the forum. yesterday i got a fine reply from the forum. thanks a lot hibernate forum...


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 23, 2005 4:34 am 
Newbie

Joined: Mon Jun 20, 2005 6:20 am
Posts: 7
Hi,

The code below should work fine:

Session session = sessionFactory.openSession();
Query query = session.createQuery("FROM user as u WHERE u.name = :username");
query.setParameter("username", "Stig");
List list = query.list();


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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.