List of usage examples for org.hibernate Query setProperties
Query<R> setProperties(Map bean);
From source file:com.eryansky.common.orm.core.hibernate.support.BasicHibernateDao.java
License:Apache License
/** * ?HQL?Query// w w w . ja v a 2 s . c o m * * @param queryOrNamedQuery hql HibernateNamedQuery * @param values * ???,??. * * @return {@link org.hibernate.Query} * */ protected Query createQuery(String queryOrNamedQuery, Map<String, ?> values) { Query query = createQuery(queryOrNamedQuery); if (values != null) { query.setProperties(values); } return query; }
From source file:com.ghy.common.orm.hibernate.HibernateDao.java
License:Apache License
/** * ? hql???maplist/*from w ww. j a v a2s . co m*/ * @param sql * @param params * @return */ public <T> List<T> findByHQL(String hql, Map<String, ?> params) { Query queryObject = getSession().createQuery(hql); if (params != null && params.size() > 0) queryObject.setProperties(params); return queryObject.list(); }
From source file:com.ghy.common.orm.hibernate.HibernateDao.java
License:Apache License
/** * ? hql???map// ww w.j av a 2 s. c o m * @param sql * @param params * @return */ public void updateByHql(String hql, Map<String, ?> values) { Query query = getSession().createQuery(hql); if (values != null && values.size() > 0) { query.setProperties(values); } query.executeUpdate(); }
From source file:com.ghy.common.orm.hibernate.HibernateDao.java
License:Apache License
/** * ? sql???map//from www. ja v a 2 s . c o m * @param sql * @param params * @return */ public void updateBySql(String sql, Map<String, ?> values) { Query query = getSession().createSQLQuery(sql); if (values != null && values.size() > 0) { query.setProperties(values); } query.executeUpdate(); }
From source file:com.ghy.common.orm.hibernate.SimpleHibernateDao.java
License:Apache License
/** * ?HQL?Query. find()???./*from w ww . j av a2 s . com*/ * * @param values * ???,??. */ public Query createQuery(final String queryString, final Map<String, ?> values) { Assert.hasText(queryString, "queryString?"); Query query = getSession().createQuery(queryString); if ((values != null) && (values.size() > 0)) { query.setProperties(values); } return query; }
From source file:com.hyzy.core.orm.hibernate.SimpleHibernateDao.java
License:Apache License
/** * ?? WEB SESSION//ww w . j a v a 2 s. c o m *?SQL?Query. find()???. * * @author:chengkunxf * @param queryString * @param values ???,??. * @return * @author: zhaozongzhan * @create: 2016316 ?11:17:42 * * @param queryString * @param values * @return */ public Query createSqlQueryBeginTransaction(final String queryString, final Map<String, ?> values) { Assert.hasText(queryString, "queryString?"); Session s = HibernateUtil.currentSession(); HibernateUtil.beginTransaction(); Query query = s.createSQLQuery(queryString); if (values != null) { query.setProperties(values); } return query; }
From source file:com.ineunet.knife.persist.dao.support.HibernateDaoImpl.java
License:Apache License
/** * ?HQL?Query. find()???.// www .ja va2 s . co m * * @param values * ???,??. */ public Query createQuery(final String queryString, final Map<String, ?> values) { Asserts.notBlank(queryString, "queryString cannot be null."); Query query = getSession().createQuery(queryString); if (values != null) query.setProperties(values); return query; }
From source file:com.jdon.persistence.hibernate.HibernateTemplate.java
License:Apache License
public List findByValueBean(final String queryString, final Object valueBean) throws Exception { return (List) doHibernate(new HibernateCallback() { public Object execute(Session session) throws HibernateException { Query queryObject = session.createQuery(queryString); prepareQuery(queryObject);// w ww.j ava 2s . c o m queryObject.setProperties(valueBean); return queryObject.list(); } }); }
From source file:com.jdon.persistence.hibernate.HibernateTemplate.java
License:Apache License
public List findByNamedQueryAndValueBean(final String queryName, final Object valueBean) throws Exception { return (List) doHibernate(new HibernateCallback() { public Object execute(Session session) throws HibernateException { Query queryObject = session.getNamedQuery(queryName); prepareQuery(queryObject);/* ww w. j a va 2 s .c om*/ queryObject.setProperties(valueBean); return queryObject.list(); } }); }
From source file:com.lakeside.data.sqldb.BaseDao.java
License:Apache License
/** * ?HQL?Query.//w w w. j av a 2s .c o m * * @param values ???,??. */ public Query createQuery(final String hql, final Map<String, ?> values) { Assert.hasText(hql, "hql?"); Query query = getSession().createQuery(hql); if (values != null) { query.setProperties(values); } return query; }