List of usage examples for org.hibernate.type NumericBooleanType INSTANCE
NumericBooleanType INSTANCE
To view the source code for org.hibernate.type NumericBooleanType INSTANCE.
Click Source Link
From source file:com.github.gekoh.yagen.hibernate.OracleNumericBooleanType.java
License:Apache License
@Override public Boolean stringToObject(String xml) throws Exception { return NumericBooleanType.INSTANCE.stringToObject(xml); }
From source file:com.github.gekoh.yagen.hibernate.OracleNumericBooleanType.java
License:Apache License
@Override public Class getPrimitiveClass() { return NumericBooleanType.INSTANCE.getPrimitiveClass(); }
From source file:com.github.gekoh.yagen.hibernate.OracleNumericBooleanType.java
License:Apache License
@Override public Serializable getDefaultValue() { return NumericBooleanType.INSTANCE.getDefaultValue(); }
From source file:com.github.gekoh.yagen.hibernate.OracleNumericBooleanType.java
License:Apache License
@Override public String objectToSQLString(Boolean value, Dialect dialect) throws Exception { return NumericBooleanType.INSTANCE.objectToSQLString(value, dialect); }
From source file:com.github.gekoh.yagen.hibernate.OracleNumericBooleanType.java
License:Apache License
@Override public String getName() { return NumericBooleanType.INSTANCE.getName(); }
From source file:com.manydesigns.portofino.persistence.hibernate.HibernateConfig.java
License:Open Source License
public boolean setHibernateType(@Nullable SimpleValue value, com.manydesigns.portofino.model.database.Column column, Class javaType, final int jdbcType) { String typeName;// w ww. ja v a 2s .co m Properties typeParams = null; if (javaType == null) { return false; } if (javaType == Long.class) { typeName = LongType.INSTANCE.getName(); } else if (javaType == Short.class) { typeName = ShortType.INSTANCE.getName(); } else if (javaType == Integer.class) { typeName = IntegerType.INSTANCE.getName(); } else if (javaType == Byte.class) { typeName = ByteType.INSTANCE.getName(); } else if (javaType == Float.class) { typeName = FloatType.INSTANCE.getName(); } else if (javaType == Double.class) { typeName = DoubleType.INSTANCE.getName(); } else if (javaType == Character.class) { typeName = CharacterType.INSTANCE.getName(); } else if (javaType == String.class) { typeName = StringType.INSTANCE.getName(); } else if (java.util.Date.class.isAssignableFrom(javaType)) { switch (jdbcType) { case Types.DATE: typeName = DateType.INSTANCE.getName(); break; case Types.TIME: typeName = TimeType.INSTANCE.getName(); break; case Types.TIMESTAMP: typeName = TimestampType.INSTANCE.getName(); break; default: typeName = null; } } else if (javaType == Boolean.class) { if (jdbcType == Types.BIT || jdbcType == Types.BOOLEAN) { typeName = BooleanType.INSTANCE.getName(); } else if (jdbcType == Types.NUMERIC || jdbcType == Types.DECIMAL || jdbcType == Types.INTEGER || jdbcType == Types.SMALLINT || jdbcType == Types.TINYINT || jdbcType == Types.BIGINT) { typeName = NumericBooleanType.INSTANCE.getName(); } else if (jdbcType == Types.CHAR || jdbcType == Types.VARCHAR) { typeName = StringBooleanType.class.getName(); typeParams = new Properties(); typeParams.setProperty("true", trueString != null ? trueString : StringBooleanType.NULL); typeParams.setProperty("false", falseString != null ? falseString : StringBooleanType.NULL); typeParams.setProperty("sqlType", String.valueOf(jdbcType)); } else { typeName = null; } } else if (javaType == BigDecimal.class) { typeName = BigDecimalType.INSTANCE.getName(); } else if (javaType == BigInteger.class) { typeName = BigIntegerType.INSTANCE.getName(); } else if (javaType == byte[].class) { typeName = BlobType.INSTANCE.getName(); } else { typeName = null; } if (typeName == null) { logger.error("Unsupported type (java type: {}, jdbc type: {}) " + "for column '{}'.", new Object[] { javaType, jdbcType, column.getColumnName() }); return false; } if (value != null) { value.setTypeName(typeName); if (typeParams != null) { value.setTypeParameters(typeParams); } } return true; }