1. 程式人生 > >CreateSqlQuery()/CreateQuery()/返回Map結果集相關方法列舉

CreateSqlQuery()/CreateQuery()/返回Map結果集相關方法列舉

Query query = this.getSession().createSQLQuery(sql).setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP);

query.setFirstResult(pageIndex);

query.setMaxResults(pageSize);

query.setParameter(i, p.get(i));

List list = query.list();

Object object = queryCount.uniqueResult(); //只能返回一個結果

int i = query.executeUpdate();

getSession().get(entityClass, id);

Serializable id = getSession().save(entity);

getSession().update(entity);

getSession().delete(entity);//有id值

getSession().clear();

getSession().evict(entity);

Query query = getSession().createQuery(sb.toString());

query.setFirstResult((currentPage - 1) * pageSize);

query.setMaxResults(pageSize);

query.setParameter(name.replace(".", ""), value);

query.setParameter(a, list.get(a));

List<E> list = query.list();

Object object = queryCount.uniqueResult(); //只能返回一個結果

int i = query.executeUpdate();