Example usage for org.hibernate SQLQuery setResultTransformer

List of usage examples for org.hibernate SQLQuery setResultTransformer

Introduction

In this page you can find the example usage for org.hibernate SQLQuery setResultTransformer.

Prototype

@Deprecated
Query<R> setResultTransformer(ResultTransformer transformer);

Source Link

Document

Set a strategy for handling the query results.

Usage

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// w  w w . ja  va2  s . c  om
 * @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>> getAutoprocResultByDataCollectionIdList(
        ArrayList<Integer> dataCollectionIdList) {

    String mySQLQuery = this.getAutoprocResultByDataCollectionIdListQuery();
    Session session = (Session) this.entityManager.getDelegate();
    SQLQuery query = session.createSQLQuery(mySQLQuery);
    query.setParameterList("dataCollectionIdList", dataCollectionIdList);
    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();// w w  w . j  ava  2s  . c  om
    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();//w  w  w  .  j  av a  2s  . 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

private List<Map<String, Object>> executeSQLQuery(SQLQuery query) {
    query.setResultTransformer(AliasToEntityMapResultTransformer.INSTANCE);
    List<Map<String, Object>> aliasToValueMapList = query.list();
    return aliasToValueMapList;
}

From source file:ispyb.server.mx.services.sample.Protein3ServiceBean.java

License:Open Source License

@Override
public List<Map<String, Object>> getStatsByProposal(int proposalId) {
    String mySQLQuery = getViewTableQuery() + " where proposalId = :proposalId";
    Session session = (Session) this.entityManager.getDelegate();
    SQLQuery query = session.createSQLQuery(mySQLQuery);
    query.setParameter("proposalId", proposalId);
    query.setResultTransformer(AliasToEntityMapResultTransformer.INSTANCE);
    return executeSQLQuery(query);
}