List of usage examples for org.hibernate.type StandardBasicTypes STRING
StringType STRING
To view the source code for org.hibernate.type StandardBasicTypes STRING.
Click Source Link
From source file:org.joda.time.contrib.hibernate.AbstractStringBasedJodaType.java
License:Apache License
public void nullSafeSet(PreparedStatement statement, Object value, int index, SessionImplementor session) throws HibernateException, SQLException { if (value == null) { StandardBasicTypes.STRING.nullSafeSet(statement, null, index, session); } else {/*from ww w. j ava2 s . co m*/ StandardBasicTypes.STRING.nullSafeSet(statement, toNonNullString(value), index, session); } }
From source file:org.joda.time.contrib.hibernate.PersistentDateTimeTZ.java
License:Apache License
public Object nullSafeGet(ResultSet rs, String[] names, SessionImplementor session, Object owner) throws HibernateException, SQLException { Object timestamp = StandardBasicTypes.TIMESTAMP.nullSafeGet(rs, names[0], session, owner); Object timezone = StandardBasicTypes.STRING.nullSafeGet(rs, names[1], session, owner); if (timestamp == null || timezone == null) { return null; }/*from w ww . ja v a2 s.co m*/ return new DateTime(timestamp, DateTimeZone.forID(timezone.toString())); }
From source file:org.joda.time.contrib.hibernate.PersistentDateTimeTZ.java
License:Apache License
public void nullSafeSet(PreparedStatement statement, Object value, int index, SessionImplementor session) throws HibernateException, SQLException { if (value == null) { StandardBasicTypes.TIMESTAMP.nullSafeSet(statement, null, index, session); StandardBasicTypes.STRING.nullSafeSet(statement, null, index + 1, session); } else {// ww w . j a v a 2 s.c o m DateTime dt = (DateTime) value; StandardBasicTypes.TIMESTAMP.nullSafeSet(statement, dt.toDate(), index, session); StandardBasicTypes.STRING.nullSafeSet(statement, dt.getZone().getID(), index + 1, session); } }
From source file:org.joda.time.contrib.hibernate.PersistentLocalTimeAsString.java
License:Apache License
public Object nullSafeGet(ResultSet rs, String[] names, SessionImplementor session, Object owner) throws HibernateException, SQLException { Object timestamp = StandardBasicTypes.STRING.nullSafeGet(rs, names[0], session, owner); if (timestamp == null) { return null; }/*w w w .ja v a 2 s .c om*/ return new LocalTime(timestamp.toString()); }
From source file:org.joda.time.contrib.hibernate.PersistentLocalTimeAsString.java
License:Apache License
public void nullSafeSet(PreparedStatement statement, Object value, int index, SessionImplementor session) throws HibernateException, SQLException { if (value == null) { StandardBasicTypes.STRING.nullSafeSet(statement, null, index, session); } else {//www .ja va 2 s . c o m LocalTime lt = ((LocalTime) value); StandardBasicTypes.STRING.nullSafeSet(statement, lt.toString(), index, session); } }
From source file:org.kuali.rice.core.framework.persistence.jpa.type.HibernateKualiCharBooleanAIType.java
License:Educational Community License
/** * Retrieves a value from the given ResultSet * // ww w . j a v a2 s.com * @see org.hibernate.usertype.UserType#nullSafeGet(java.sql.ResultSet, java.lang.String[], java.lang.Object) */ public Object nullSafeGet(ResultSet rs, String[] names, Object owner) throws HibernateException, SQLException { String value = (String) StandardBasicTypes.STRING.nullSafeGet(rs, names[0]); Boolean converted = null; if (value != null) { try { if (value.equalsIgnoreCase("A")) converted = Boolean.TRUE; if (value.equalsIgnoreCase("I")) converted = Boolean.FALSE; } catch (Exception e) { throw new RuntimeException("Unable to get status value from db: " + e.getMessage()); } if (converted == null) { throw new RuntimeException("Unable to get status value from db: "); } } return converted; }
From source file:org.n52.sos.config.sqlite.HibernateSQLiteDialect.java
License:Open Source License
public HibernateSQLiteDialect() { registerColumnType(Types.BIT, "integer"); registerColumnType(Types.TINYINT, "tinyint"); registerColumnType(Types.SMALLINT, "smallint"); registerColumnType(Types.INTEGER, "integer"); registerColumnType(Types.BIGINT, "bigint"); registerColumnType(Types.FLOAT, "float"); registerColumnType(Types.REAL, "real"); registerColumnType(Types.DOUBLE, "double"); registerColumnType(Types.NUMERIC, "numeric"); registerColumnType(Types.DECIMAL, "decimal"); registerColumnType(Types.CHAR, "char"); registerColumnType(Types.VARCHAR, "varchar"); registerColumnType(Types.LONGVARCHAR, "longvarchar"); registerColumnType(Types.DATE, "date"); registerColumnType(Types.TIME, "time"); registerColumnType(Types.TIMESTAMP, "timestamp"); registerColumnType(Types.BINARY, "blob"); registerColumnType(Types.VARBINARY, "blob"); registerColumnType(Types.LONGVARBINARY, "blob"); registerColumnType(Types.BLOB, "blob"); registerColumnType(Types.CLOB, "clob"); registerColumnType(Types.BOOLEAN, "integer"); registerFunction("concat", new VarArgsSQLFunction(StandardBasicTypes.STRING, "", "||", "")); registerFunction("mod", new SQLFunctionTemplate(StandardBasicTypes.INTEGER, "?1 % ?2")); registerFunction("substr", new StandardSQLFunction("substr", StandardBasicTypes.STRING)); registerFunction("substring", new StandardSQLFunction("substr", StandardBasicTypes.STRING)); sqliteUniqueDelegate = new SQLiteUniqueDelegate(this); }
From source file:org.niord.core.db.MySQLSpatialDialect.java
License:Apache License
MySQLSpatialFunctions() { functionsToRegister.put("dimension", new StandardSQLFunction("dimension", StandardBasicTypes.INTEGER)); functionsToRegister.put("geometrytype", new StandardSQLFunction("geometrytype", StandardBasicTypes.STRING)); functionsToRegister.put("srid", new StandardSQLFunction("srid", StandardBasicTypes.INTEGER)); functionsToRegister.put("envelope", new StandardSQLFunction("envelope")); functionsToRegister.put("astext", new StandardSQLFunction("astext", StandardBasicTypes.STRING)); functionsToRegister.put("asbinary", new StandardSQLFunction("asbinary", StandardBasicTypes.BINARY)); functionsToRegister.put("isempty", new StandardSQLFunction("isempty", StandardBasicTypes.BOOLEAN)); functionsToRegister.put("issimple", new StandardSQLFunction("issimple", StandardBasicTypes.BOOLEAN)); // Register functions for spatial relation constructs functionsToRegister.put("overlaps", new StandardSQLFunction("overlaps", StandardBasicTypes.BOOLEAN)); functionsToRegister.put("intersects", new StandardSQLFunction("intersects", StandardBasicTypes.BOOLEAN)); functionsToRegister.put("equals", new StandardSQLFunction("equals", StandardBasicTypes.BOOLEAN)); functionsToRegister.put("contains", new StandardSQLFunction("contains", StandardBasicTypes.BOOLEAN)); functionsToRegister.put("crosses", new StandardSQLFunction("crosses", StandardBasicTypes.BOOLEAN)); functionsToRegister.put("disjoint", new StandardSQLFunction("disjoint", StandardBasicTypes.BOOLEAN)); functionsToRegister.put("touches", new StandardSQLFunction("touches", StandardBasicTypes.BOOLEAN)); functionsToRegister.put("within", new StandardSQLFunction("within", StandardBasicTypes.BOOLEAN)); }
From source file:org.olat.core.util.coordinate.DBPersistentLockManager.java
License:Apache License
/** * Delete all persisting-locks for certain identity. * @see org.olat.user.UserDataDeletable#deleteUserData(org.olat.core.id.Identity) */// w w w . ja v a 2 s . c o m public void deleteUserData(Identity identity, String newDeletedUserName) { String query = "from v in class org.olat.properties.Property where v.category = ? and v.longValue = ?"; DBFactory.getInstance().delete(query, new Object[] { CATEGORY_PERSISTENTLOCK, identity.getKey() }, new Type[] { StandardBasicTypes.STRING, StandardBasicTypes.LONG }); log.debug("All db-persisting-locks deleted for identity=" + identity); }
From source file:org.openbravo.advpaymentmngt.utility.APRMApplicationInitializer.java
License:Open Source License
@Override public void initialize() { OBDal.getInstance().registerSQLFunction("ad_message_get2", new StandardSQLFunction("ad_message_get2", StandardBasicTypes.STRING)); OBDal.getInstance().registerSQLFunction("hqlagg", new SQLFunctionTemplate(StandardBasicTypes.STRING, getAggregationSQL())); OBDal.getInstance().registerSQLFunction("get_uuid", new StandardSQLFunction("get_uuid", StandardBasicTypes.STRING)); }