-->
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: Need Criteria Upgrade Tips (Hb2->hb3)
PostPosted: Fri Dec 30, 2005 12:31 am 
Beginner
Beginner

Joined: Fri Dec 26, 2003 3:21 pm
Posts: 23
Location: Jakarta
Just want to ask you all,

I have this code, this is run well on hb 2.1.7

Criteria crit = session.createCriteria(User.class);
crit.add(Expression.eq("username", new String(username)));


I read the Migration tips from issaco to change the Criteria object become Expression.

like this

Expression crit = session.createCriteria(User.class);
crit.add(Expression.eq("username", new String(username)));

but the add still problem, not found.


i find that there is a Criterion object, what kind of case I can use to implement Criterion.

and what is the replacement of add of my criteria which I found in hibernate 2.1.7

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 30, 2005 12:50 am 
Expert
Expert

Joined: Thu May 26, 2005 9:19 am
Posts: 262
Location: Oak Creek, WI
Hi,

There is not much of a change as u have done, Its simple as that in Hibernate 3.x,

i.e)
Criteria crit = session.createCriteria(User.class);
crit.add(Expression.eq("username", new String(username)));
List userlist = crit.list();

for more info read these below links

http://www.hibernate.org/hib_docs/v3/re ... g-criteria
http://www.hibernate.org/hib_docs/v3/re ... teria.html

_________________
RamnathN
Senior Software Engineer
http://www.linkedin.com/in/ramnathn
Don't forget to rate.


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.