hibernate
文章平均质量分 81
kiss_vicente
神马都是浮云,java才是永恒.
展开
-
Hibernate中Query.uniqueResult();
如果有多个值抛错如果有值且只有一个,返回一个object如果没值,返回null得到记录数ProjectionsProjectionList projList = Projections.projectionList(); projList.add(Projections.rowCount()); if (groupProperty原创 2011-11-07 15:43:10 · 7078 阅读 · 0 评论 -
org.hibernate.hql.ast.QuerySyntaxException: is not mapped 异常总结
org.hibernate.hql.ast.QuerySyntaxException: User is not mapped [select u from User u where u.userName=:userName and u.password=:password] at org.hibernate.hql.ast.util.SessionFactoryHelper.requir原创 2011-11-07 10:54:55 · 68053 阅读 · 27 评论 -
HibernateTemplate相关方法
/** * 向数据库添加一条对应于一个业务对象实例的记录* * @param entity * 业务对象实例 */ public Entity create(Entity entity) throws DaoException {try { getHibernateTemplate().save(entity); return enti原创 2011-11-07 15:40:56 · 1884 阅读 · 0 评论 -
Hibernate面试
1 SessoinFactorya) 用来产生和管理Sessionb) 通常情况下每个应用只需要一个SessionFactoryc) 除非要访间多个数据库的情况d) 关注两个方法即:openSession getCurrentsession的区别 i. ope原创 2011-10-08 14:27:46 · 1647 阅读 · 0 评论