Home  >  Forum  >  Hibernate
Post New Query

Use of criteria in hibernate



Asked on September 17, 2013
I don't know what does this line mean. Can you please explain me its meaning?
List<Car> list=session.createCriteria(Car.class).add(Restrictions.naturalId().set("vehicleRegNum","UP65 BN 2343")).list();

I refer to your tutorials and this query is in the below given page:
http://www.concretepage.com/hibernate/naturalid_hibernate_annotation.php



Replied on September 17, 2013
Here Car is an entity representing car table and session.createCriteria will create the query like

select * from car where vehicleRegNum='UP65 BN 2343'

list will contain the result of this query



Replied on October 10, 2013
Good Explanation


Write Answer







©2019 concretepage.com | Privacy Policy | Contact Us