package com.haha.test;
import java.util.List;
import org.hibernate.Criteria;
import org.hibernate.Hibernate;
import org.hibernate.Query;
import org.hibernate.criterion.Example;
import com.haha.dao.HibernateSessionFactory;
import com.haha.info.Books;
public class Test1 {
public static void main(String[] args) {
BookWhere1 bk=new BookWhere1();
bk.setId(5000);
bk.setName("java%");
Query qq=HibernateSessionFactory.getSession()
.createQuery("from Books where id>:id and title like :name");
qq.setProperties(bk);
List<Books> list=qq.list();
for(Books b:list){
System.out.println(b.getId()+","+b.getTitle());
}
}
}
原文:http://www.cnblogs.com/tian114527375/p/4964541.html