List of usage examples for org.hibernate.type StandardBasicTypes INTEGER
IntegerType INTEGER
To view the source code for org.hibernate.type StandardBasicTypes INTEGER.
Click Source Link
From source file:es.jpons.temporal.types.TemporalPKType.java
License:Open Source License
public void nullSafeSet(PreparedStatement ps, Object o, int index, SessionImplementor si) throws HibernateException, SQLException { TemporalPK value = (TemporalPK) o;/* w w w . j ava 2s . c om*/ Integer id = value.getId(); Integer vid = value.getVid(); StandardBasicTypes.INTEGER.nullSafeSet(ps, id, index, si); StandardBasicTypes.INTEGER.nullSafeSet(ps, vid, index + 1, si); }
From source file:eu.europa.ec.fisheries.uvms.spatial.service.dao.AbstractAreaDao.java
License:Open Source License
public List<BaseAreaEntity> closestArea(final List<AreaLocationTypesEntity> entities, final DatabaseDialect dialect, final Point point) { List resultList = new ArrayList(); if (dialect != null && CollectionUtils.isNotEmpty(entities) && (point != null && !point.isEmpty())) { final StringBuilder sb = new StringBuilder(); final Double longitude = point.getX(); final Double latitude = point.getY(); Iterator<AreaLocationTypesEntity> it = entities.iterator(); sb.append(dialect.closestAreaToPointPrefix()); int index = 0; while (it.hasNext()) { AreaLocationTypesEntity next = it.next(); final String areaDbTable = next.getAreaDbTable(); final String typeName = next.getTypeName(); sb.append(dialect.closestAreaToPoint(index, typeName, areaDbTable, latitude, longitude, 10)); index++;//from w ww.ja v a 2 s . c o m it.remove(); // avoids a ConcurrentModificationException if (it.hasNext()) { sb.append(UNION_ALL); } } sb.append(dialect.closestAreaToPointSuffix()); log.debug(QUERY, dialect.getClass().getSimpleName().toUpperCase(), sb.toString()); javax.persistence.Query emNativeQuery = getEntityManager().createNativeQuery(sb.toString()); emNativeQuery.unwrap(SQLQuery.class).addScalar(TYPE, StandardBasicTypes.STRING) .addScalar(GID, StandardBasicTypes.INTEGER).addScalar(CODE, StandardBasicTypes.STRING) .addScalar(NAME, StandardBasicTypes.STRING) .addScalar(CLOSEST, org.hibernate.spatial.GeometryType.INSTANCE); resultList = emNativeQuery.getResultList(); } return resultList; }
From source file:eu.europa.ec.fisheries.uvms.spatial.service.dao.AbstractAreaDao.java
License:Open Source License
public List<BaseAreaEntity> intersectingArea(final List<AreaLocationTypesEntity> entities, final DatabaseDialect dialect, final Point point) { List resultList = new ArrayList(); int index = 1; if (dialect != null && CollectionUtils.isNotEmpty(entities) && (point != null && !point.isEmpty())) { final StringBuilder sb = new StringBuilder(); final Double longitude = point.getX(); final Double latitude = point.getY(); Iterator<AreaLocationTypesEntity> it = entities.iterator(); sb.append("select * from ("); while (it.hasNext()) { AreaLocationTypesEntity next = it.next(); final String areaDbTable = next.getAreaDbTable(); final String typeName = next.getTypeName(); sb.append("(SELECT ").append(index).append(" as indexRS,").append("'").append(typeName) .append("' as type, gid, code, name FROM spatial.").append(areaDbTable).append(" WHERE ") .append(dialect.stIntersects(latitude, longitude)).append(" AND enabled = 'Y')"); it.remove(); // avoids a ConcurrentModificationException index++;//w w w . j a va2s.c om if (it.hasNext()) { sb.append(UNION_ALL); } } sb.append(") a ORDER BY indexRS, gid ASC "); log.debug(QUERY, dialect.getClass().getSimpleName().toUpperCase(), sb.toString()); javax.persistence.Query emNativeQuery = getEntityManager().createNativeQuery(sb.toString()); emNativeQuery.unwrap(SQLQuery.class).addScalar(TYPE, StandardBasicTypes.STRING) .addScalar(GID, StandardBasicTypes.INTEGER).addScalar(CODE, StandardBasicTypes.STRING) .addScalar(NAME, StandardBasicTypes.STRING); resultList = emNativeQuery.getResultList(); } return resultList; }
From source file:gov.nih.nci.cabig.caaers.accesscontrol.query.impl.AbstractIdFetcher.java
License:BSD License
/** * Generates the query/*w w w. ja v a 2s .com*/ * @param loginId * @param sql * @param nativeQuery * @return */ protected AbstractQuery createQuery(String loginId, String sql, boolean nativeQuery) { AbstractQuery query; if (nativeQuery) { query = new NativeSQLQuery(sql); ((NativeSQLQuery) query).setScalar("id", StandardBasicTypes.INTEGER); } else { query = new HQLQuery(sql); } if (loginId != null) query.getParameterMap().put("LOGIN_ID", loginId); return query; }
From source file:gov.nih.nci.cabig.caaers.dao.query.NativeSQLQueryTest.java
License:BSD License
public void testSetScalar() throws Exception { query.setScalar("id", StandardBasicTypes.INTEGER); assertSame(StandardBasicTypes.INTEGER, query.getScalarType("id")); }
From source file:gov.nih.nci.cabig.caaers.dao.query.NativeSQLQueryTest.java
License:BSD License
public void testGetScalarNames() throws Exception { query.setScalar("x", StandardBasicTypes.INTEGER); query.setScalar("y", StandardBasicTypes.INTEGER); Set<String> s = new HashSet<String>(); s.add("x");//from w w w . j a v a 2 s .c om s.add("y"); assertEquals(s, query.getScalarNames()); }
From source file:gov.nih.nci.cabig.caaers.dao.query.NativeSQLQueryTest.java
License:BSD License
public void testGetScalarType() throws Exception { query.setScalar("id", StandardBasicTypes.INTEGER); assertSame(StandardBasicTypes.INTEGER, query.getScalarType("id")); assertNull(query.getScalarType("junk")); }
From source file:jp.xet.baseunits.hibernate.PersistentDayOfMonth.java
License:Apache License
/** * ?? * * @since 1.2 */ public PersistentDayOfMonth() { super(StandardBasicTypes.INTEGER); }
From source file:jp.xet.baseunits.hibernate.PersistentHourOfDay.java
License:Apache License
/** * ?? * * @since 1.2 */ public PersistentHourOfDay() { super(StandardBasicTypes.INTEGER); }
From source file:jp.xet.baseunits.hibernate.PersistentMinuteDuration.java
License:Apache License
/** * ?? * * @since 1.2 */ public PersistentMinuteDuration() { super(StandardBasicTypes.INTEGER); }