List of usage examples for org.hibernate SQLQuery setParameter
@Override NativeQuery<T> setParameter(int position, Object val);
From source file:ispyb.server.common.services.proposals.Proposal3ServiceBean.java
License:Open Source License
private List findProposalByProposalId(Integer proposalId) { Session session = (Session) this.entityManager.getDelegate(); SQLQuery query = session.createSQLQuery( "select " + SqlTableMapper.getProposalTable() + " from Proposal where proposalId= :proposalId"); query.setParameter("proposalId", proposalId); query.setResultTransformer(AliasToEntityMapResultTransformer.INSTANCE); return query.list(); }
From source file:ispyb.server.common.services.shipping.external.External3ServiceBean.java
License:Open Source License
@Override public List<Map<String, Object>> getDataCollectionByProposal(String proposalCode, String proposalNumber) { String mySQLQuery = SQLQueryKeeper.getDataCollectionByProposal(); Session session = (Session) this.entityManager.getDelegate(); SQLQuery query = session.createSQLQuery(mySQLQuery); query.setParameter("proposalCode", proposalCode); query.setParameter("proposalNumber", proposalNumber); query.setResultTransformer(AliasToEntityMapResultTransformer.INSTANCE); @SuppressWarnings("unchecked") List<Map<String, Object>> aliasToValueMapList = query.list(); return aliasToValueMapList; }
From source file:ispyb.server.common.services.shipping.external.External3ServiceBean.java
License:Open Source License
/** * Return session by proposal code and number * @param code MX, opd, SAXS//from w ww .j a va2 s. c o m * @param number * @return */ @Override public List<Map<String, Object>> getSessionsByProposalCodeAndNumber(String proposalCode, String proposalNumber) { String mySQLQuery = SQLQueryKeeper.getSessionByCodeAndNumber(); Session session = (Session) this.entityManager.getDelegate(); SQLQuery query = session.createSQLQuery(mySQLQuery); query.setParameter("proposalCode", proposalCode); query.setParameter("proposalNumber", proposalNumber); query.setResultTransformer(AliasToEntityMapResultTransformer.INSTANCE); return executeSQLQuery(query); }
From source file:ispyb.server.common.services.shipping.external.External3ServiceBean.java
License:Open Source License
@Override public List<Map<String, Object>> getDataCollectionFromShippingId(int shippingId) { String mySQLQuery = this.getDataCollectionFromShippingId(); Session session = (Session) this.entityManager.getDelegate(); SQLQuery query = session.createSQLQuery(mySQLQuery); query.setParameter("shippingId", shippingId); query.setResultTransformer(AliasToEntityMapResultTransformer.INSTANCE); return executeSQLQuery(query); }
From source file:ispyb.server.common.services.shipping.external.External3ServiceBean.java
License:Open Source License
@Override public List<Map<String, Object>> getAllDataCollectionFromShippingId(int shippingId) { String mySQLQuery = this.getAllDataCollectionFromShippingId(); Session session = (Session) this.entityManager.getDelegate(); SQLQuery query = session.createSQLQuery(mySQLQuery); query.setParameter("shippingId", shippingId); query.setResultTransformer(AliasToEntityMapResultTransformer.INSTANCE); return executeSQLQuery(query); }
From source file:ispyb.server.common.services.shipping.external.External3ServiceBean.java
License:Open Source License
@Override public List<Map<String, Object>> getPhasingAnalysisByDataCollectionIdListQuery(Integer autoProcIntegrationId) { String mySQLQuery = this.getPhasingAnalysisByDataCollectionIdListQuery(); Session session = (Session) this.entityManager.getDelegate(); SQLQuery query = session.createSQLQuery(mySQLQuery); query.setParameter("autoProcIntegrationId", autoProcIntegrationId); query.setResultTransformer(AliasToEntityMapResultTransformer.INSTANCE); return executeSQLQuery(query); }
From source file:ispyb.server.common.services.shipping.Shipping3ServiceBean.java
License:Open Source License
@Override public List<Map<String, Object>> getShippingById(final Integer shippingId) throws Exception { checkCreateChangeRemoveAccess();/*from w w w . j av a 2 s . c o m*/ String mySQLQuery = FIND_BY_SHIPPING_ID(); Session session = (Session) this.entityManager.getDelegate(); SQLQuery query = session.createSQLQuery(mySQLQuery); query.setParameter("shippingId", shippingId); query.setResultTransformer(AliasToEntityMapResultTransformer.INSTANCE); List<Map<String, Object>> aliasToValueMapList = query.list(); return aliasToValueMapList; }
From source file:ispyb.server.common.services.shipping.Shipping3ServiceBean.java
License:Open Source License
@Override public List<Map<String, Object>> getShippingByProposalId(final Integer proposalId) throws Exception { checkCreateChangeRemoveAccess();//from w ww. j a va 2 s. c o m String mySQLQuery = FIND_BY_PROPOSAL_ID(); Session session = (Session) this.entityManager.getDelegate(); SQLQuery query = session.createSQLQuery(mySQLQuery); query.setParameter("proposalId", proposalId); query.setResultTransformer(AliasToEntityMapResultTransformer.INSTANCE); List<Map<String, Object>> aliasToValueMapList = query.list(); return aliasToValueMapList; }
From source file:ispyb.server.common.services.ws.rest.session.SessionServiceBean.java
License:Open Source License
@Override public List<Map<String, Object>> getSessionViewBySessionId(int proposalId, int sessionId) { Session session = (Session) this.entityManager.getDelegate(); SQLQuery query = session.createSQLQuery(BySessionId); /** Setting the parameters **/ query.setParameter("sessionId", sessionId); query.setParameter("proposalId", proposalId); return executeSQLQuery(query); }
From source file:ispyb.server.common.services.ws.rest.session.SessionServiceBean.java
License:Open Source License
@Override public List<Map<String, Object>> getSessionViewByProposalId(int proposalId) { Session session = (Session) this.entityManager.getDelegate(); SQLQuery query = session.createSQLQuery(ByProposalId); System.out.println(query.getQueryString()); /** Setting the parameters **/ query.setParameter("proposalId", proposalId); return executeSQLQuery(query); }