List of usage examples for org.hibernate.type StandardBasicTypes BINARY
BinaryType BINARY
To view the source code for org.hibernate.type StandardBasicTypes BINARY.
Click Source Link
From source file:com.vmware.sqlfire.hibernate.SQLFireDialect.java
License:Open Source License
public SQLFireDialect() { super();//from ww w. j av a 2s . c o m LOG.info("SQLFireDialect for Hibernate 4 initialized."); registerFunction("concat", new DerbyConcatFunction()); registerFunction("trim", new AnsiTrimFunction()); registerFunction("value", new StandardSQLFunction("coalesce")); registerFunction("nvl", new NvlFunction()); registerFunction("groups", new StandardSQLFunction("GROUPS", StandardBasicTypes.STRING)); registerFunction("dsid", new StandardSQLFunction("DSID", StandardBasicTypes.STRING)); registerFunction("groupsintersection", new StandardSQLFunction("GROUPSINTERSECTION", StandardBasicTypes.STRING)); registerFunction("groupsintersect", new StandardSQLFunction("GROUPSINTERSECT", StandardBasicTypes.BOOLEAN)); registerFunction("groupsunion", new StandardSQLFunction("GROUPSUNION", StandardBasicTypes.STRING)); registerFunction("longint", new StandardSQLFunction("bigint", StandardBasicTypes.LONG)); registerFunction("int", new StandardSQLFunction("integer", StandardBasicTypes.INTEGER)); registerFunction("pi", new StandardSQLFunction("pi", StandardBasicTypes.DOUBLE)); registerFunction("random", new NoArgSQLFunction("random", StandardBasicTypes.DOUBLE)); registerFunction("rand", new StandardSQLFunction("rand", StandardBasicTypes.DOUBLE));// override registerFunction("sinh", new StandardSQLFunction("sinh", StandardBasicTypes.DOUBLE)); registerFunction("cosh", new StandardSQLFunction("cosh", StandardBasicTypes.DOUBLE)); registerFunction("tanh", new StandardSQLFunction("tanh", StandardBasicTypes.DOUBLE)); registerFunction("user", new NoArgSQLFunction("USER", StandardBasicTypes.STRING, false)); registerFunction("current_user", new NoArgSQLFunction("CURRENT_USER", StandardBasicTypes.STRING, false)); registerFunction("session_user", new NoArgSQLFunction("SESSION_USER", StandardBasicTypes.STRING, false)); registerFunction("current isolation", new NoArgSQLFunction("CURRENT ISOLATION", StandardBasicTypes.STRING, false)); registerFunction("current_role", new NoArgSQLFunction("CURRENT_ROLE", StandardBasicTypes.STRING, false)); registerFunction("current schema", new NoArgSQLFunction("CURRENT SCHEMA", StandardBasicTypes.STRING, false)); registerFunction("current sqlid", new NoArgSQLFunction("CURRENT SQLID", StandardBasicTypes.STRING, false)); registerFunction("xmlexists", new StandardSQLFunction("XMLEXISTS", StandardBasicTypes.NUMERIC_BOOLEAN)); registerFunction("xmlparse", new StandardSQLFunction("XMLPARSE", StandardBasicTypes.TEXT)); registerFunction("xmlquery", new StandardSQLFunction("XMLQUERY", StandardBasicTypes.STRING)); registerFunction("xmlserialize", new StandardSQLFunction("XMLSERIALIZE", StandardBasicTypes.STRING)); registerFunction("get_current_connection", new NoArgSQLFunction("GET_CURRENT_CONNECTION", StandardBasicTypes.BINARY, true)); registerFunction("identity_val_local", new NoArgSQLFunction("IDENTITY_VAL_LOCAL", StandardBasicTypes.BINARY, true)); }
From source file:com.vmware.sqlfire.hibernate.v4.v0.SQLFireDialect.java
License:Open Source License
public SQLFireDialect() { super();/*from ww w . j a v a2 s . c o m*/ LOG.info("SQLFireDialect for Hibernate 4.0 initialized."); registerFunction("concat", new DerbyConcatFunction()); registerFunction("trim", new AnsiTrimFunction()); registerFunction("value", new StandardSQLFunction("coalesce")); registerFunction("nvl", new NvlFunction()); registerFunction("groups", new StandardSQLFunction("GROUPS", StandardBasicTypes.STRING)); registerFunction("dsid", new StandardSQLFunction("DSID", StandardBasicTypes.STRING)); registerFunction("groupsintersection", new StandardSQLFunction("GROUPSINTERSECTION", StandardBasicTypes.STRING)); registerFunction("groupsintersect", new StandardSQLFunction("GROUPSINTERSECT", StandardBasicTypes.BOOLEAN)); registerFunction("groupsunion", new StandardSQLFunction("GROUPSUNION", StandardBasicTypes.STRING)); registerFunction("longint", new StandardSQLFunction("bigint", StandardBasicTypes.LONG)); registerFunction("int", new StandardSQLFunction("integer", StandardBasicTypes.INTEGER)); registerFunction("pi", new StandardSQLFunction("pi", StandardBasicTypes.DOUBLE)); registerFunction("random", new NoArgSQLFunction("random", StandardBasicTypes.DOUBLE)); registerFunction("rand", new StandardSQLFunction("rand", StandardBasicTypes.DOUBLE));// override registerFunction("sinh", new StandardSQLFunction("sinh", StandardBasicTypes.DOUBLE)); registerFunction("cosh", new StandardSQLFunction("cosh", StandardBasicTypes.DOUBLE)); registerFunction("tanh", new StandardSQLFunction("tanh", StandardBasicTypes.DOUBLE)); registerFunction("user", new NoArgSQLFunction("USER", StandardBasicTypes.STRING, false)); registerFunction("current_user", new NoArgSQLFunction("CURRENT_USER", StandardBasicTypes.STRING, false)); registerFunction("session_user", new NoArgSQLFunction("SESSION_USER", StandardBasicTypes.STRING, false)); registerFunction("current isolation", new NoArgSQLFunction("CURRENT ISOLATION", StandardBasicTypes.STRING, false)); registerFunction("current_role", new NoArgSQLFunction("CURRENT_ROLE", StandardBasicTypes.STRING, false)); registerFunction("current schema", new NoArgSQLFunction("CURRENT SCHEMA", StandardBasicTypes.STRING, false)); registerFunction("current sqlid", new NoArgSQLFunction("CURRENT SQLID", StandardBasicTypes.STRING, false)); registerFunction("xmlexists", new StandardSQLFunction("XMLEXISTS", StandardBasicTypes.NUMERIC_BOOLEAN)); registerFunction("xmlparse", new StandardSQLFunction("XMLPARSE", StandardBasicTypes.TEXT)); registerFunction("xmlquery", new StandardSQLFunction("XMLQUERY", StandardBasicTypes.STRING)); registerFunction("xmlserialize", new StandardSQLFunction("XMLSERIALIZE", StandardBasicTypes.STRING)); registerFunction("get_current_connection", new NoArgSQLFunction("GET_CURRENT_CONNECTION", StandardBasicTypes.BINARY, true)); registerFunction("identity_val_local", new NoArgSQLFunction("IDENTITY_VAL_LOCAL", StandardBasicTypes.BINARY, true)); }
From source file:org.candlepin.hibernate.ResultDataUserType.java
License:Open Source License
@Override public Object nullSafeGet(ResultSet rs, String[] names, SharedSessionContractImplementor session, Object owner) throws HibernateException, SQLException { byte[] data = StandardBasicTypes.BINARY.nullSafeGet(rs, names[0], session); return deserialize(data); }
From source file:org.candlepin.hibernate.ResultDataUserType.java
License:Open Source License
@Override public void nullSafeSet(PreparedStatement st, Object value, int index, SharedSessionContractImplementor session) throws HibernateException, SQLException { StandardBasicTypes.BINARY.nullSafeSet(st, serializeJson(value), index, session); }
From source file:org.inwiss.platform.persistence.util.BinaryBlobType.java
License:Apache License
/** * Get a hashcode for the instance, consistent with persistence "equality" *///from w w w .j ava 2 s .co m public int hashCode(Object x) throws HibernateException { return StandardBasicTypes.BINARY.getHashCode(x, null); }
From source file:org.inwiss.platform.persistence.util.BinaryBlobType.java
License:Apache License
/** * Retrieve an instance of the mapped class from a JDBC resultset. Implementors * should handle possibility of null values. * * @param rs a JDBC result set/* w w w .j ava 2 s .co m*/ * @param names the column names * @param session * @param owner the containing entity * @return Object * @throws org.hibernate.HibernateException * * @throws java.sql.SQLException */ public Object nullSafeGet(ResultSet rs, String[] names, SessionImplementor session, Object owner) throws HibernateException, SQLException { if (isBlob) { Blob blob = (Blob) Hibernate.BLOB.nullSafeGet(rs, names, session, owner); if (blob == null) return null; else return copyData(blob.getBinaryStream()); } else { return StandardBasicTypes.BINARY.nullSafeGet(rs, names, session, owner); } }
From source file:org.inwiss.platform.persistence.util.BinaryBlobType.java
License:Apache License
/** * Write an instance of the mapped class to a prepared statement. Implementors * should handle possibility of null values. A multi-column type should be written * to parameters starting from <tt>index</tt>. * * @param st a JDBC prepared statement * @param value the object to write/*from w w w .ja v a 2 s.com*/ * @param index statement parameter index * @param session * @throws org.hibernate.HibernateException * * @throws java.sql.SQLException */ public void nullSafeSet(PreparedStatement st, Object value, int index, SessionImplementor session) throws HibernateException, SQLException { if (isBlob) { if (value == null) Hibernate.BLOB.nullSafeSet(st, value, index, session); else { Blob blob = Hibernate.createBlob((byte[]) value); Hibernate.BLOB.nullSafeSet(st, blob, index, session); } } else { StandardBasicTypes.BINARY.nullSafeSet(st, value, index, session); } }
From source file:org.inwiss.platform.persistence.util.BinaryBlobType.java
License:Apache License
/** * Return a deep copy of the persistent state, stopping at entities and at collections. * * @param value generally a collection element or entity field * @return Object a copy//from w w w . ja va 2 s. c om * @throws org.hibernate.HibernateException * */ public Object deepCopy(Object value) throws HibernateException { return StandardBasicTypes.BINARY.deepCopy(value, null, null); }
From source file:org.inwiss.platform.persistence.util.BinaryBlobType.java
License:Apache License
/** * Check if objects of this type mutable. * * @return boolean */ public boolean isMutable() { return StandardBasicTypes.BINARY.isMutable(); }
From source file:org.inwiss.platform.persistence.util.BinaryBlobType.java
License:Apache License
/** * Transform the object into its cacheable representation. At the very least this * method should perform a deep copy. That may not be enough for some implementations, * however; for example, associations must be cached as identifier values. (optional * operation)/*from w ww . j av a 2 s. com*/ * * @param value the object to be cached * @param session * @return a cachable representation of the object * @throws org.hibernate.HibernateException * */ public Serializable disassemble(Object value, SessionImplementor session) throws HibernateException { return StandardBasicTypes.BINARY.disassemble(value, session, null); }