Example usage for org.hibernate.type LongType LongType

List of usage examples for org.hibernate.type LongType LongType

Introduction

In this page you can find the example usage for org.hibernate.type LongType LongType.

Prototype

public LongType() 

Source Link

Usage

From source file:ubic.gemma.persistence.service.expression.experiment.ExpressionExperimentDaoImpl.java

License:Apache License

@Override
public Collection<ExpressionExperiment> findByGene(Gene gene) {

    /*//from ww  w.ja  v a2s  . co  m
     * uses GENE2CS table.
     */
    //language=MySQL
    final String queryString = "SELECT DISTINCT ee.ID AS eeID FROM "
            + "GENE2CS g2s, COMPOSITE_SEQUENCE cs, ARRAY_DESIGN ad, BIO_ASSAY ba, INVESTIGATION ee "
            + "WHERE g2s.CS = cs.ID AND ad.ID = cs.ARRAY_DESIGN_FK AND ba.ARRAY_DESIGN_USED_FK = ad.ID AND"
            + " ba.EXPRESSION_EXPERIMENT_FK = ee.ID AND g2s.GENE = :geneID";

    Collection<Long> eeIds;

    Session session = this.getSessionFactory().getCurrentSession();
    org.hibernate.SQLQuery queryObject = session.createSQLQuery(queryString);
    queryObject.setLong("geneID", gene.getId());
    queryObject.addScalar("eeID", new LongType());
    ScrollableResults results = queryObject.scroll();

    eeIds = new HashSet<>();

    while (results.next()) {
        eeIds.add(results.getLong(0));
    }

    return this.load(eeIds);
}