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.biosaxs.services.core.analysis.Analysis3ServiceBean.java

License:Open Source License

@Override
public List<Map<String, Object>> getExperimentListByExperimentId(Integer proposalId, Integer experimentId) {
    String mySQLQuery = SQLQueryKeeper.getExperimentListByExperimentId(proposalId, experimentId);
    Session session = (Session) this.entityManager.getDelegate();
    SQLQuery query = session.createSQLQuery(mySQLQuery);
    query.setParameter("proposalId", proposalId);
    query.setParameter("experimentId", experimentId);
    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>> getCompactAnalysisByExperimentId(int experimentId) {
    String mySQLQuery = SQLQueryKeeper.getAnalysisCompactQueryByExperimentId();
    Session session = (Session) this.entityManager.getDelegate();
    SQLQuery query = session.createSQLQuery(mySQLQuery);
    query.setParameter("experimentId", experimentId);
    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>> getCompactAnalysisByProposalId(Integer proposalId, Integer limit) {
    StringBuilder mySQLQuery = new StringBuilder(SQLQueryKeeper.getAnalysisCompactQueryByProposalId(limit));
    Session session = (Session) this.entityManager.getDelegate();
    SQLQuery query = session.createSQLQuery(mySQLQuery.toString());
    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>> getCompactAnalysisByProposalId(Integer proposalId, Integer start,
        Integer limit) {//  w  w  w .jav a 2 s . c  o  m
    StringBuilder mySQLQuery = new StringBuilder(
            SQLQueryKeeper.getAnalysisCompactQueryByProposalId(start, limit));
    Session session = (Session) this.entityManager.getDelegate();
    SQLQuery query = session.createSQLQuery(mySQLQuery.toString());
    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>> getCompactAnalysisBySubtractionId(String subtractionId) {
    StringBuilder mySQLQuery = new StringBuilder(SQLQueryKeeper.getAnalysisCompactQueryBySubtractionId());
    Session session = (Session) this.entityManager.getDelegate();
    SQLQuery query = session.createSQLQuery(mySQLQuery.toString());
    query.setParameter("subtractionId", subtractionId);
    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>> getCompactAnalysisByMacromoleculeId(Integer proposalId,
        Integer macromoleculeId) {
    StringBuilder mySQLQuery = new StringBuilder(SQLQueryKeeper.getAnalysisCompactQueryByMacromoleculeId());
    System.out.println(mySQLQuery.toString());
    Session session = (Session) this.entityManager.getDelegate();
    SQLQuery query = session.createSQLQuery(mySQLQuery.toString());
    query.setParameter("proposalId", proposalId);
    query.setParameter("macromoleculeId", macromoleculeId);

    query.setResultTransformer(AliasToEntityMapResultTransformer.INSTANCE);
    @SuppressWarnings("unchecked")
    List<Map<String, Object>> aliasToValueMapList = query.list();
    return aliasToValueMapList;
}

From source file:ispyb.server.common.daos.shipping.Shipping3DAOBean.java

License:Open Source License

@Override
public List<Map<String, Object>> getShippingById(int shippingId) {
    String mySQLQuery = this.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.daos.shipping.Shipping3DAOBean.java

License:Open Source License

@Override
public List<Map<String, Object>> getShippingByProposalId(int proposalId) {
    String mySQLQuery = this.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.proposals.Proposal3ServiceBean.java

License:Open Source License

@Override
public List<Map<String, Object>> findProposals() {
    Session session = (Session) this.entityManager.getDelegate();
    SQLQuery query = session.createSQLQuery("select " + SqlTableMapper.getProposalTable() + " from Proposal");
    query.setResultTransformer(AliasToEntityMapResultTransformer.INSTANCE);
    @SuppressWarnings("unchecked")
    List<Map<String, Object>> aliasToValueMapList = query.list();
    return aliasToValueMapList;
}

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();
}