List of usage examples for org.hibernate SQLQuery setResultTransformer
@Deprecated Query<R> setResultTransformer(ResultTransformer transformer);
From source file:gemlite.core.internal.support.jpa.files.dao.GmBatchDaoImpl.java
License:Apache License
@Override public Map queryJobExecutionById(Long executionId) { StringBuilder sb = new StringBuilder(); sb.append("SELECT a.*,b.job_name"); sb.append(//from w w w . ja v a2 s . c o m " from BATCH_JOB_EXECUTION a left join batch_job_instance b on a.job_instance_id = b.job_instance_id where a.JOB_EXECUTION_ID = ?"); Query query = em.createNativeQuery(sb.toString()); SQLQuery nativeQuery = query.unwrap(SQLQuery.class); nativeQuery.setParameter(0, executionId); nativeQuery.setResultTransformer(CriteriaSpecification.ALIAS_TO_ENTITY_MAP); List<Map> list = nativeQuery.list(); return (list == null || list.isEmpty()) ? null : toLowerCaseKey(list).get(0); }
From source file:gemlite.core.internal.support.jpa.files.dao.GmBatchDaoImpl.java
License:Apache License
@Override public List<Map> queryStepNamesForJob(String jobName) { String sql = "SELECT E.JOB_EXECUTION_ID, E.START_TIME, E.END_TIME, E.STATUS, E.EXIT_CODE, E.EXIT_MESSAGE, E.CREATE_TIME, E.LAST_UPDATED, E.VERSION, I.JOB_INSTANCE_ID, I.JOB_NAME" + " FROM BATCH_JOB_EXECUTION E, BATCH_JOB_INSTANCE I WHERE E.JOB_INSTANCE_ID=I.JOB_INSTANCE_ID and I.JOB_NAME=? ORDER BY JOB_EXECUTION_ID DESC"; Query query = em.createNativeQuery(sql); SQLQuery nativeQuery = query.unwrap(SQLQuery.class); nativeQuery.setParameter(0, jobName); nativeQuery.setResultTransformer(CriteriaSpecification.ALIAS_TO_ENTITY_MAP); List<Map> list = nativeQuery.list(); return toLowerCaseKey(list); }
From source file:gemlite.core.internal.support.jpa.files.dao.GmBatchDaoImpl.java
License:Apache License
@Override public List<Map> queryStepExecutionsById(Long jobExecutionId) { StringBuilder sb = new StringBuilder(); sb.append("SELECT STEP_EXECUTION_ID, STEP_NAME, START_TIME, END_TIME, STATUS, COMMIT_COUNT,"); sb.append(" READ_COUNT, FILTER_COUNT, WRITE_COUNT, EXIT_CODE, EXIT_MESSAGE, READ_SKIP_COUNT,"); sb.append(" WRITE_SKIP_COUNT, PROCESS_SKIP_COUNT, ROLLBACK_COUNT, LAST_UPDATED, VERSION from "); sb.append(" BATCH_STEP_EXECUTION where JOB_EXECUTION_ID = ?"); sb.append(" order by STEP_EXECUTION_ID"); Query query = em.createNativeQuery(sb.toString()); SQLQuery nativeQuery = query.unwrap(SQLQuery.class); nativeQuery.setParameter(0, jobExecutionId); nativeQuery.setResultTransformer(CriteriaSpecification.ALIAS_TO_ENTITY_MAP); List<Map> list = nativeQuery.list(); return toLowerCaseKey(list); }
From source file:gov.utah.dts.det.ccl.dao.impl.FacilityDaoImpl.java
License:Open Source License
@Override public List<UserCaseloadCount> getUserCaseloadCounts() { Session session = (Session) em.getDelegate(); SQLQuery query = session.createSQLQuery(CASELOAD_COUNT_QUERY); query.addScalar("id", StandardBasicTypes.LONG); query.addScalar("name", StandardBasicTypes.STRING); query.addScalar("roleType", StandardBasicTypes.STRING); query.addScalar("active", StandardBasicTypes.YES_NO); query.addScalar("count", StandardBasicTypes.LONG); query.setResultTransformer(Transformers.aliasToBean(UserCaseloadCount.class)); return (List<UserCaseloadCount>) query.list(); }
From source file:ispyb.server.biosaxs.services.core.analysis.abInitioModelling.AbInitioModelling3ServiceBean.java
License:Open Source License
private List<Map<String, Object>> getAll(String mySQLQuery) { Session session = (Session) this.entityManager.getDelegate(); SQLQuery query = session.createSQLQuery(mySQLQuery); query.setResultTransformer(AliasToEntityMapResultTransformer.INSTANCE); @SuppressWarnings("unchecked") List<Map<String, Object>> aliasToValueMapList = query.list(); return aliasToValueMapList; }
From source file:ispyb.server.biosaxs.services.core.analysis.abInitioModelling.AbInitioModelling3ServiceBean.java
License:Open Source License
@Override public List<Map<String, Object>> getAnalysisCalibrationByProposalId(int experimentId) { String mySQLQuery = SQLQueryKeeper.getAnalysisCalibrationByProposalId(experimentId); Session session = (Session) this.entityManager.getDelegate(); SQLQuery query = session.createSQLQuery(mySQLQuery); query.setResultTransformer(AliasToEntityMapResultTransformer.INSTANCE); @SuppressWarnings("unchecked") List<Map<String, Object>> aliasToValueMapList = query.list(); return aliasToValueMapList; }
From source file:ispyb.server.biosaxs.services.core.analysis.abInitioModelling.AbInitioModelling3ServiceBean.java
License:Open Source License
@Override public List<Map<String, Object>> getAnalysisInformation(int limit) { String mySQLQuery = SQLQueryKeeper.getAnalysis(limit); Session session = (Session) this.entityManager.getDelegate(); SQLQuery query = session.createSQLQuery(mySQLQuery); query.setResultTransformer(AliasToEntityMapResultTransformer.INSTANCE); @SuppressWarnings("unchecked") List<Map<String, Object>> aliasToValueMapList = query.list(); return aliasToValueMapList; }
From source file:ispyb.server.biosaxs.services.core.analysis.Analysis3ServiceBean.java
License:Open Source License
@Override public List<Map<String, Object>> getExperimentListByProposalId(int proposalId) { String mySQLQuery = SQLQueryKeeper.getExperimentListByProposalId(proposalId); Session session = (Session) this.entityManager.getDelegate(); SQLQuery query = session.createSQLQuery(mySQLQuery); query.setParameter("proposalId", proposalId); query.setResultTransformer(AliasToEntityMapResultTransformer.INSTANCE); @SuppressWarnings("unchecked") List<Map<String, Object>> aliasToValueMapList = query.list(); return aliasToValueMapList; }
From source file:ispyb.server.biosaxs.services.core.analysis.Analysis3ServiceBean.java
License:Open Source License
@Override public List<Map<String, Object>> getExperimentListByProposalId(int proposalId, String experimentType) { String mySQLQuery = SQLQueryKeeper.getExperimentListByProposalId(proposalId, experimentType); Session session = (Session) this.entityManager.getDelegate(); SQLQuery query = session.createSQLQuery(mySQLQuery); query.setParameter("proposalId", proposalId); query.setParameter("experimentType", experimentType); query.setResultTransformer(AliasToEntityMapResultTransformer.INSTANCE); @SuppressWarnings("unchecked") List<Map<String, Object>> aliasToValueMapList = query.list(); return aliasToValueMapList; }
From source file:ispyb.server.biosaxs.services.core.analysis.Analysis3ServiceBean.java
License:Open Source License
@Override public List<Map<String, Object>> getExperimentListBySessionId(Integer proposalId, Integer sessionId) { String mySQLQuery = SQLQueryKeeper.getExperimentListBySessionId(proposalId, sessionId); Session session = (Session) this.entityManager.getDelegate(); SQLQuery query = session.createSQLQuery(mySQLQuery); query.setParameter("proposalId", proposalId); query.setParameter("sessionId", sessionId); query.setResultTransformer(AliasToEntityMapResultTransformer.INSTANCE); @SuppressWarnings("unchecked") List<Map<String, Object>> aliasToValueMapList = query.list(); return aliasToValueMapList; }