use of org.hibernate.type.DoubleType in project Gemma by PavlidisLab.
the class DifferentialExpressionResultDaoImpl method findGeneInResultSets.
@Override
public List<Double> findGeneInResultSets(Gene gene, ExpressionAnalysisResultSet resultSet, Collection<Long> arrayDesignIds, Integer limit) {
StopWatch timer = new StopWatch();
timer.start();
List<Double> results;
Session session = this.getSessionFactory().getCurrentSession();
org.hibernate.SQLQuery queryObject = session.createSQLQuery(DifferentialExpressionResultDaoImpl.fetchResultsByResultSetAndGeneQuery);
queryObject.setLong("gene_id", gene.getId());
queryObject.setLong("rs_id", resultSet.getId());
if (limit != null) {
queryObject.setMaxResults(limit);
}
queryObject.addScalar("CORRECTED_PVALUE", new DoubleType());
// noinspection unchecked
results = queryObject.list();
timer.stop();
if (AbstractDao.log.isDebugEnabled())
AbstractDao.log.debug("Fetching probeResults from resultSet " + resultSet.getId() + " for gene " + gene.getId() + "and " + arrayDesignIds.size() + "arrays took : " + timer.getTime() + " ms");
return results;
}
use of org.hibernate.type.DoubleType in project dhis2-core by dhis2.
the class HibernatePropertyIntrospector method createProperty.
private Property createProperty(Class<?> klass, org.hibernate.mapping.Property hibernateProperty, MetamodelImplementor metamodelImplementor) {
Property property = new Property(klass);
property.setRequired(false);
property.setPersisted(true);
property.setWritable(true);
property.setOwner(true);
Type type = hibernateProperty.getType();
property.setName(hibernateProperty.getName());
property.setFieldName(hibernateProperty.getName());
property.setCascade(hibernateProperty.getCascade());
property.setCollection(type.isCollectionType());
property.setSetterMethod(hibernateProperty.getSetter(klass).getMethod());
property.setGetterMethod(hibernateProperty.getGetter(klass).getMethod());
if (property.isCollection()) {
initCollectionProperty(metamodelImplementor, property, (CollectionType) type);
}
if (type instanceof SingleColumnType || type instanceof CustomType || type instanceof ManyToOneType) {
Column column = (Column) hibernateProperty.getColumnIterator().next();
property.setUnique(column.isUnique());
property.setRequired(!column.isNullable());
property.setMin(0d);
property.setMax((double) column.getLength());
property.setLength(column.getLength());
if (type instanceof TextType) {
property.setMin(0d);
property.setMax((double) Integer.MAX_VALUE);
property.setLength(Integer.MAX_VALUE);
} else if (type instanceof IntegerType) {
property.setMin((double) Integer.MIN_VALUE);
property.setMax((double) Integer.MAX_VALUE);
property.setLength(Integer.MAX_VALUE);
} else if (type instanceof LongType) {
property.setMin((double) Long.MIN_VALUE);
property.setMax((double) Long.MAX_VALUE);
property.setLength(Integer.MAX_VALUE);
} else if (type instanceof DoubleType) {
property.setMin(-Double.MAX_VALUE);
property.setMax(Double.MAX_VALUE);
property.setLength(Integer.MAX_VALUE);
}
}
if (type instanceof ManyToOneType) {
property.setManyToOne(true);
property.setRequired(property.isRequired() && !property.isCollection());
if (property.isOwner()) {
property.setOwningRole(klass.getName() + "." + property.getName());
} else {
property.setInverseRole(klass.getName() + "." + property.getName());
}
} else if (type instanceof OneToOneType) {
property.setOneToOne(true);
} else if (type instanceof OneToMany) {
property.setOneToMany(true);
}
return property;
}
Aggregations