public void Query()
{
String hql ="from examples.Cat c where cat_id like '3%'"; //正常(cat_id是主键)
//String hql ="from examples.Cat c where name like '%name%'"; //使用这句则报下面的错. Query query = psession.createQuery(hql);
List l = query .list();
Iterator lst = l.iterator();
while (lst.hasNext())
{
Cat c1 = (Cat) lst.next();
System.out.println(c1.getName());
}
}
{
String hql ="from examples.Cat c where cat_id like '3%'"; //正常(cat_id是主键)
//String hql ="from examples.Cat c where name like '%name%'"; //使用这句则报下面的错. Query query = psession.createQuery(hql);
List l = query .list();
Iterator lst = l.iterator();
while (lst.hasNext())
{
Cat c1 = (Cat) lst.next();
System.out.println(c1.getName());
}
}
解决方案 »
- 帮解释一下这些配置。。。。。。。。。。。。。。。。。。。。。。
- tomcat的错误信息 如何调整 谢谢
- hiberate 查询时抛tbl_trade is not mapped [from tbl_trade]的异常
- HQL 的查询语句怎么写啊?
- spring +ibatis数据库连接异常(Cannot create PoolableConnectionFactory )
- 不改页面的源码是不是不能让指定字符高亮
- ejb跟数据库不能同步的问题!!!!!!!
- tomcat的配置问题
- 在WebLogic中如何知道,数据源配置成功。
- 有无ejb的入门教程或例子。请教大家。
- hibernate入门的例子,查询出错.
- 感觉用myeclipse进行有关的J2EE的开发好复杂呀!欢迎大家过来谈谈自己的看法!
{
String hql ="from examples.Cat c where cat_id like '3%'"; //正常(cat_id是主键)
//String hql ="from examples.Cat c where name like '%name%'"; //使用这句则报下面的错.
List query = psession.createQuery(hql).list();
for (Iterator lst = query.iterate(); lst.hasNext();)
{
Cat c1 = (Cat) lst.next();
System.out.println(c1.getName());
}
}