百度广告
我定义了一个类:HibernateBooleanDemo
String hql = "from HibernateBooleanDemo where isEnabled=false";
Transaction t = s.beginTransaction();
List list = q.list();
System.out.println(((HibernateBooleanDemo)list.get(0)).isEnabled());
HibernateSessionFactory.closeSession();
一直不明白是什么原因。请大家指点
若"from HibernateBooleanDemo where isEnabled=false";写为"from HibernateBooleanDemo where enabled=false";错误
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:936)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1573)
at com.mysql.jdbc.Connection.execSQL(Connection.java:3124)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1262)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1669)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
... 8 more
from HibernateBooleanDemo h where h.enabled=false
【AmethystWish】:
Exception in thread "main" org.hibernate.QueryException: could not resolve property: enabled of: org.acman.demo.HibernateBooleanDemo [from org.acman.demo.HibernateBooleanDemo h where h.enabled=false]
点击加载更多评论>>