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:com.vmware.sqlfire.hibernate.v4.v0.SQLFireDialect.java
License:Open Source License
public SQLFireDialect() { super();/*from w w w .ja v a 2 s .co 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:com.vnet.demo.hibernate.support.SQLServerNativeDialect.java
License:Apache License
public SQLServerNativeDialect() { super();/*from ww w . jav a 2 s . c om*/ registerColumnType(Types.CHAR, "nchar(1)"); registerColumnType(Types.LONGVARCHAR, "nvarchar(max)"); registerColumnType(Types.VARCHAR, 4000, "nvarchar($l)"); registerColumnType(Types.VARCHAR, "nvarchar(max)"); registerColumnType(Types.CLOB, "nvarchar(max)"); registerColumnType(Types.NCHAR, "nchar(1)"); registerColumnType(Types.LONGNVARCHAR, "nvarchar(max)"); registerColumnType(Types.NVARCHAR, 4000, "nvarchar($l)"); registerColumnType(Types.NVARCHAR, "nvarchar(max)"); registerColumnType(Types.NCLOB, "nvarchar(max)"); registerHibernateType(Types.NCHAR, StandardBasicTypes.CHARACTER.getName()); registerHibernateType(Types.LONGNVARCHAR, StandardBasicTypes.TEXT.getName()); registerHibernateType(Types.NVARCHAR, StandardBasicTypes.STRING.getName()); registerHibernateType(Types.NCLOB, StandardBasicTypes.CLOB.getName()); }
From source file:com.xpn.xwiki.store.hibernate.WikiSQLServerDialect.java
License:Open Source License
/** * constructor./*from w ww .ja v a 2 s .c o m*/ */ public WikiSQLServerDialect() { super(); registerFunction("str", new SQLFunctionTemplate(StandardBasicTypes.STRING, "cast(?1 as varchar)")); }
From source file:debop4k.data.orm.hibernate.usertypes.encrypt.HashStringUserType.java
License:Apache License
@Override public int[] sqlTypes() { return new int[] { StandardBasicTypes.STRING.sqlType() }; }
From source file:debop4k.data.orm.hibernate.usertypes.jodatime.DateTimeAsIsoFormatHMSUserType.java
License:Apache License
@Override public Object nullSafeGet(ResultSet rs, String[] names, SessionImplementor session, Object owner) throws HibernateException, SQLException { String value = (String) StandardBasicTypes.STRING.nullSafeGet(rs, names[0], session, owner); return KodaTimex.asIsoFormatDateHMS(value); }
From source file:debop4k.data.orm.hibernate.usertypes.jodatime.DateTimeAsIsoFormatHMSUserType.java
License:Apache License
@Override public void nullSafeSet(PreparedStatement st, Object value, int index, SessionImplementor session) throws HibernateException, SQLException { if (value == null) { StandardBasicTypes.STRING.nullSafeSet(st, null, index, session); } else {/*from www .j a va2 s . co m*/ String isoStr = KodaTimex.asIsoFormatDateHMSString((DateTime) value); StandardBasicTypes.STRING.nullSafeSet(st, isoStr, index, session); } }
From source file:debop4k.data.orm.hibernate.usertypes.jodatime.DateTimeAsIsoFormatStringUserType.java
License:Apache License
@Override public Object nullSafeGet(ResultSet rs, String[] names, SessionImplementor session, Object owner) throws HibernateException, SQLException { String value = (String) StandardBasicTypes.STRING.nullSafeGet(rs, names[0], session, owner); return KodaTimex.asIsoFormatDateTime(value); }
From source file:debop4k.data.orm.hibernate.usertypes.jodatime.DateTimeAsIsoFormatStringUserType.java
License:Apache License
@Override public void nullSafeSet(PreparedStatement st, Object value, int index, SessionImplementor session) throws HibernateException, SQLException { if (value == null) { StandardBasicTypes.STRING.nullSafeSet(st, null, index, session); } else {/*from ww w . j a va 2 s . co m*/ String isoStr = KodaTimex.asIsoFormatDateTimeString((DateTime) value); log.trace("DateTime ISO Format={}", isoStr); StandardBasicTypes.STRING.nullSafeSet(st, isoStr, index, session); } }
From source file:debop4k.data.orm.hibernate.usertypes.jodatime.TimestampAndTimeZoneUserType.java
License:Apache License
@Override public int[] sqlTypes() { return new int[] { StandardBasicTypes.TIMESTAMP.sqlType(), StandardBasicTypes.STRING.sqlType() }; }
From source file:debop4k.data.orm.hibernate.usertypes.jodatime.TimestampAndTimeZoneUserType.java
License:Apache License
@Override public Object nullSafeGet(ResultSet rs, String[] names, SessionImplementor session, Object owner) throws HibernateException, SQLException { Timestamp timestamp = (Timestamp) StandardBasicTypes.TIMESTAMP.nullSafeGet(rs, names[0], session, owner); String zoneId = (String) StandardBasicTypes.STRING.nullSafeGet(rs, names[1], session, owner); if (timestamp != null) { return (zoneId != null) ? new DateTime(timestamp, DateTimeZone.forID(zoneId)) : new DateTime(timestamp, DateTimeZone.UTC); } else {//from ww w. j a v a 2 s . com return null; } }