onetomany and manytoone
摘要:@OneToMany(fetch = FetchType.EAGER, targetEntity = DocConstraint.class, cascade={CascadeType.REMOVE}, mappedBy = "docid")public List<DocConstraint> getConstraintList() {return constraintList;}public void setConstraintList(List<DocConstraint> constraintList) {this.constraintList
阅读全文
oarcle hql语句中的 (xx=:名称)hql语句中传值
摘要:public void updateProcessHistoryStatus(String className, Long id, Integer status) {final String hql = "UPDATE ProcessHistory SET flowStatus = :status WHERE instanceType=:instanceType and instancePk = :instancePk";this.getSession().createQuery(hql).setInteger("status", status).set
阅读全文
unexpected end of subtree(hql拼写有误,仔细查看hql语句,以及参数值的导入)
摘要:org.hibernate.hql.ast.QuerySyntaxException: unexpected end of subtree
阅读全文
hiabernate 中createQuery与createSQLQuery区别
摘要:hiabernate 中createQuery与createSQLQuery区别,使用经验hibernate 中createQuery与createSQLQuery两者区别是:前者用的hql语句进行查询,后者可以用sql语句查询前者以hibernate生成的Bean为对象装入list返回后者则是以对象数组进行存储所以使用createSQLQuery有时候也想以hibernate生成的Bean为对象装入list返回,就不是很方便突然发现createSQLQuery有这样一个方法可以直接转换对象Query query = session.createSQLQuery(sql).addEntity(
阅读全文
dao层的查询、删除语句
摘要:public abstract class BaseHibernateDao<E, PK extends Serializable> extends HibernateDaoSupport implementsEntityDao<E, PK> {public List<DocumentUser> getByDocTransferId(Long id) { //1.String hql = "from DocumentUser where doctransferId=" + id; return this.getHibernateTempl
阅读全文