public void testQLb()
{
Session s = sessionFactory.getCurrentSession();
s.beginTransaction();
Query q = s.createQuery("from Category c where c.name > 'c5'");
List<Category> categorys = q.list();
for(Category c: categorys)
{
System.out.println(c.getName());
}
s.getTransaction().commit();
}
这段代码报错
原因没有加 Annotation 的 @Test
修改
@Test
public void testQLb()
{
Session s = sessionFactory.getCurrentSession();
s.beginTransaction();
Query q = s.createQuery("from Category c where c.name > 'c5'");
List<Category> categorys = q.list();
for(Category c: categorys)
{
System.out.println(c.getName());
}
s.getTransaction().commit();
}
so easy