List of usage examples for org.hibernate SQLQuery list
List<R> list();
From source file:com.sapienter.jbilling.server.metafields.db.MetaFieldDAS.java
License:Open Source License
public List<Integer> getCustomerFieldValues(Integer customerId, MetaFieldType type) { if (null == customerId || null == type) { throw new IllegalArgumentException("can have null arguments for customer or type"); }/* w w w.j a v a 2 s .co m*/ SQLQuery query = getSession().createSQLQuery(findCustomerValuesSQL); query.setParameter("type", type.toString()); query.setParameter("customer", customerId); return query.list(); }
From source file:com.sapienter.jbilling.server.metafields.db.MetaFieldDAS.java
License:Open Source License
public List<Integer> getCustomerFieldValues(Integer customerId, MetaFieldType type, Integer groupId, Date effectiveDate) {//from ww w . j av a 2s.c om if (null == customerId || null == type || null == groupId) { throw new IllegalArgumentException("can have null arguments for customer, type or group"); } SQLQuery query = getSession().createSQLQuery(findCustomerValuesByGroupSQL); query.setParameter("type", type.toString()); query.setParameter("customer", customerId); query.setParameter("groupId", groupId); query.setDate("startDate", effectiveDate); return query.list(); }
From source file:com.sapienter.jbilling.server.metafields.db.MetaFieldDAS.java
License:Open Source License
@SuppressWarnings("unchecked") public List<Integer> getByFieldType(Integer entityId, MetaFieldType[] types) { if (null == entityId || null == types || types.length == 0) { throw new IllegalArgumentException("entity and types must be defined"); }//w w w . ja v a 2s. com String strTypes[] = toStringArray(types); SQLQuery query = getSession().createSQLQuery(getByFieldTypes); query.setParameter("entity", entityId); query.setParameterList("types", strTypes); return query.list(); }
From source file:com.sapienter.jbilling.server.metafields.db.MetaFieldDAS.java
License:Open Source License
public List<Integer> findByValue(MetaField field, Object value, Boolean sensitive) { if (null == field || null == value) { throw new IllegalArgumentException("arguments field and/or value can not be null"); }/*from w ww .j a va 2 s. co m*/ StringBuilder queryBuilder = getFindByValueQueryBuilder(field.getDataType(), value, sensitive); SQLQuery query = getSession().createSQLQuery(queryBuilder.toString()); return query.list(); }
From source file:com.sapienter.jbilling.server.metafields.db.MetaFieldDAS.java
License:Open Source License
public List<Integer> findByValueAndField(DataType type, Object value, Boolean sensitive, List<Integer> fields) { if (null == type || null == value || null == fields) { throw new IllegalArgumentException("arguments type/value/fields can not be null"); }/* w w w . jav a2 s . c o m*/ StringBuilder queryBuilder = getFindByValueQueryBuilder(type, value, sensitive); queryBuilder.append(" and meta_field_name_id in (:fields)"); SQLQuery query = getSession().createSQLQuery(queryBuilder.toString()); query.setParameterList("fields", fields); return query.list(); }
From source file:com.sapienter.jbilling.server.metafields.db.MetaFieldDAS.java
License:Open Source License
public List<Integer> getValuesByCustomerAndFields(Integer customerId, List<Integer> fields) { if (null == customerId || null == fields || fields.size() == 0) { throw new IllegalArgumentException(" customer and fields can not be null"); }/*w w w . ja va 2s.c o m*/ SQLQuery query = getSession().createSQLQuery(getValuesByCustomerFields); query.setParameter("customer", customerId); query.setParameterList("fields", fields); query.setDate("startDate", new Date()); return query.list(); }
From source file:com.sapienter.jbilling.server.metafields.db.MetaFieldDAS.java
License:Open Source License
public List<Integer> findPlansByMetaFieldValue(MetaField metaField, String value, Integer entityId) { SQLQuery query = getSession().createSQLQuery(getPlansByMetaFieldQuery); query.setParameter("mfId", metaField.getId()); query.setParameter("value", value); query.setParameter("entityId", entityId); return query.list(); }
From source file:com.school.dao.StageImplement.java
@Override public List<Stage> getAllStages() { List<Stage> stages = null; try {//from w ww . j a v a2 s. c o m hibernateDriver.openSession(); String sql = "SELECT * FROM STAGE"; SQLQuery query = hibernateDriver.getSession().createSQLQuery(sql); query.addEntity(Stage.class); stages = query.list(); System.out.println("NUM OF STAGES:" + stages.size()); hibernateDriver.closeSession(); } catch (HibernateException ex) { ex.printStackTrace(); } return stages; }
From source file:com.school.dao.StageImplement.java
/** * ***************************************************************************************************** * **************************************** ROW OPERATION ******************************************************* * ***************************************************************************************************** * @param stage/*from w w w . j av a2 s . c o m*/ * @return */ @Override public List<RowsOFStage> getAllRows(Stage stage) { hibernateDriver.openSession(); String sql = "SELECT * FROM Rows_OF_Stage WHERE stage_id= :stageID"; SQLQuery query = hibernateDriver.getSession().createSQLQuery(sql); query.addEntity(RowsOFStage.class); query.setParameter("stageID", stage.getId()); List<RowsOFStage> results = query.list(); hibernateDriver.closeSession(); return results; }
From source file:com.school.dao.UserImplement.java
@Override public List<Student> getAllStudents() { hibernateDriver.openSession();/* ww w .j a v a2 s . c om*/ String sql = "SELECT * FROM USERS where USER_TYPE='Student' order by JOIN_DATE asc"; SQLQuery query = hibernateDriver.getSession().createSQLQuery(sql); query.addEntity(Student.class); List<Student> students = query.list(); hibernateDriver.closeSession(); return students; }