Example usage for org.hibernate SQLQuery setParameter

List of usage examples for org.hibernate SQLQuery setParameter

Introduction

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

Prototype

@Override
    NativeQuery<T> setParameter(int position, Object val);

Source Link

Usage

From source file:ispyb.server.biosaxs.services.stats.Stats3ServiceBean.java

License:Open Source License

@Override
public List getExperimentsBy(String type, String start, String end) {
    Session session = (Session) this.entityManager.getDelegate();
    SQLQuery query = session.createSQLQuery(GET_EXPERIMENT_COUNT_BY_DATE);
    query.setParameter("TYPE", type);
    query.setParameter("START", start);
    query.setParameter("END", end);
    return query.list();
}

From source file:ispyb.server.biosaxs.services.stats.Stats3ServiceBean.java

License:Open Source License

@Override
public List getFramesBy(String start, String end) {
    Session session = (Session) this.entityManager.getDelegate();
    SQLQuery query = session.createSQLQuery(GET_FRAMES_COUNT_BY_DATE);
    query.setParameter("START", start);
    query.setParameter("END", end);
    return query.list();
}

From source file:ispyb.server.biosaxs.services.stats.Stats3ServiceBean.java

License:Open Source License

@Override
public List<Map<String, Object>> getAutoprocStatsByDate(String autoprocStatisticsType, Date startDate,
        Date endDate) {//from w  w w . j  a va 2 s  . com
    Session session = (Session) this.entityManager.getDelegate();
    SQLQuery query = session.createSQLQuery(AUTOPROCSTATS_QUERY);
    SimpleDateFormat dt1 = new SimpleDateFormat("yyyy-MM-dd");
    query.setParameter("START", dt1.format(startDate));
    query.setParameter("END", dt1.format(endDate));
    query.setParameter("TYPE", autoprocStatisticsType);
    return executeSQLQuery(query);
}

From source file:ispyb.server.biosaxs.services.stats.Stats3ServiceBean.java

License:Open Source License

@Override
public List<Map<String, Object>> getAutoprocStatsByDate(String autoprocStatisticsType, Date startDate,
        Date endDate, String beamline) {
    Session session = (Session) this.entityManager.getDelegate();
    SQLQuery query = session.createSQLQuery(AUTOPROCSTATS_QUERY + "  and beamLineName = :BEAMLINENAME ");
    SimpleDateFormat dt1 = new SimpleDateFormat("yyyy-MM-dd");
    query.setParameter("START", dt1.format(startDate));
    query.setParameter("END", dt1.format(endDate));
    query.setParameter("TYPE", autoprocStatisticsType);
    query.setParameter("BEAMLINENAME", beamline);
    return executeSQLQuery(query);
}

From source file:ispyb.server.biosaxs.services.ws.rest.datacollection.SaxsDataCollectionRestWsServiceBean.java

License:Open Source License

@Override
public Collection<? extends Map<String, Object>> getDataCollectionByExperimentId(int proposalId,
        Integer experimentId) {//from  www  . j av a2 s.  c  o m
    Session session = (Session) this.entityManager.getDelegate();
    SQLQuery query = session.createSQLQuery(ByExperimentId);
    query.setParameter("proposalId", proposalId);
    query.setParameter("experimentId", experimentId);
    return executeSQLQuery(query);
}

From source file:ispyb.server.biosaxs.services.ws.rest.datacollection.SaxsDataCollectionRestWsServiceBean.java

License:Open Source License

@Override
public Collection<? extends Map<String, Object>> getDataCollectionBySessionId(int proposalId,
        Integer sessionId) {//w ww  .j av a  2s.  com
    Session session = (Session) this.entityManager.getDelegate();
    SQLQuery query = session.createSQLQuery(BySessionId);
    query.setParameter("proposalId", proposalId);
    query.setParameter("sessionId", sessionId);
    return executeSQLQuery(query);
}

From source file:ispyb.server.biosaxs.services.ws.rest.datacollection.SaxsDataCollectionRestWsServiceBean.java

License:Open Source License

@Override
public Collection<? extends Map<String, Object>> getDataCollectionByMacromoleculeId(int proposalId,
        Integer macromoleculeId) {
    Session session = (Session) this.entityManager.getDelegate();
    SQLQuery query = session.createSQLQuery(ByMacromoleculeId);
    query.setParameter("proposalId", proposalId);
    query.setParameter("macromoleculeId", macromoleculeId);
    System.out.println(query);/*from   ww w . j av  a2  s.c  o m*/
    return executeSQLQuery(query);
}

From source file:ispyb.server.biosaxs.services.ws.rest.datacollection.SaxsDataCollectionRestWsServiceBean.java

License:Open Source License

@Override
public Collection<? extends Map<String, Object>> getDataCollectionByDataCollectionId(int proposalId,
        Integer dataCollectionId) {
    Session session = (Session) this.entityManager.getDelegate();
    SQLQuery query = session.createSQLQuery(ByDataCollectionId);
    query.setParameter("proposalId", proposalId);
    query.setParameter("dataCollectionId", dataCollectionId);
    return executeSQLQuery(query);
}

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