org.hibernate.dialect.unique.DefaultUniqueDelegate Java Examples
The following examples show how to use
org.hibernate.dialect.unique.DefaultUniqueDelegate.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Dialect.java From lams with GNU General Public License v2.0 | 4 votes |
protected Dialect() { LOG.usingDialect( this ); StandardAnsiSqlAggregationFunctions.primeFunctionMap( sqlFunctions ); // standard sql92 functions (can be overridden by subclasses) registerFunction( "substring", new SQLFunctionTemplate( StandardBasicTypes.STRING, "substring(?1, ?2, ?3)" ) ); registerFunction( "locate", new SQLFunctionTemplate( StandardBasicTypes.INTEGER, "locate(?1, ?2, ?3)" ) ); registerFunction( "trim", new SQLFunctionTemplate( StandardBasicTypes.STRING, "trim(?1 ?2 ?3 ?4)" ) ); registerFunction( "length", new StandardSQLFunction( "length", StandardBasicTypes.INTEGER ) ); registerFunction( "bit_length", new StandardSQLFunction( "bit_length", StandardBasicTypes.INTEGER ) ); registerFunction( "coalesce", new StandardSQLFunction( "coalesce" ) ); registerFunction( "nullif", new StandardSQLFunction( "nullif" ) ); registerFunction( "abs", new StandardSQLFunction( "abs" ) ); registerFunction( "mod", new StandardSQLFunction( "mod", StandardBasicTypes.INTEGER) ); registerFunction( "sqrt", new StandardSQLFunction( "sqrt", StandardBasicTypes.DOUBLE) ); registerFunction( "upper", new StandardSQLFunction("upper") ); registerFunction( "lower", new StandardSQLFunction("lower") ); registerFunction( "cast", new CastFunction() ); registerFunction( "extract", new SQLFunctionTemplate(StandardBasicTypes.INTEGER, "extract(?1 ?2 ?3)") ); //map second/minute/hour/day/month/year to ANSI extract(), override on subclasses registerFunction( "second", new SQLFunctionTemplate(StandardBasicTypes.INTEGER, "extract(second from ?1)") ); registerFunction( "minute", new SQLFunctionTemplate(StandardBasicTypes.INTEGER, "extract(minute from ?1)") ); registerFunction( "hour", new SQLFunctionTemplate(StandardBasicTypes.INTEGER, "extract(hour from ?1)") ); registerFunction( "day", new SQLFunctionTemplate(StandardBasicTypes.INTEGER, "extract(day from ?1)") ); registerFunction( "month", new SQLFunctionTemplate(StandardBasicTypes.INTEGER, "extract(month from ?1)") ); registerFunction( "year", new SQLFunctionTemplate(StandardBasicTypes.INTEGER, "extract(year from ?1)") ); registerFunction( "str", new SQLFunctionTemplate(StandardBasicTypes.STRING, "cast(?1 as char)") ); registerColumnType( Types.BIT, "bit" ); registerColumnType( Types.BOOLEAN, "boolean" ); registerColumnType( Types.TINYINT, "tinyint" ); registerColumnType( Types.SMALLINT, "smallint" ); registerColumnType( Types.INTEGER, "integer" ); registerColumnType( Types.BIGINT, "bigint" ); registerColumnType( Types.FLOAT, "float($p)" ); registerColumnType( Types.DOUBLE, "double precision" ); registerColumnType( Types.NUMERIC, "numeric($p,$s)" ); registerColumnType( Types.REAL, "real" ); registerColumnType( Types.DATE, "date" ); registerColumnType( Types.TIME, "time" ); registerColumnType( Types.TIMESTAMP, "timestamp" ); registerColumnType( Types.VARBINARY, "bit varying($l)" ); registerColumnType( Types.LONGVARBINARY, "bit varying($l)" ); registerColumnType( Types.BLOB, "blob" ); registerColumnType( Types.CHAR, "char($l)" ); registerColumnType( Types.VARCHAR, "varchar($l)" ); registerColumnType( Types.LONGVARCHAR, "varchar($l)" ); registerColumnType( Types.CLOB, "clob" ); registerColumnType( Types.NCHAR, "nchar($l)" ); registerColumnType( Types.NVARCHAR, "nvarchar($l)" ); registerColumnType( Types.LONGNVARCHAR, "nvarchar($l)" ); registerColumnType( Types.NCLOB, "nclob" ); // register hibernate types for default use in scalar sqlquery type auto detection registerHibernateType( Types.BIGINT, StandardBasicTypes.BIG_INTEGER.getName() ); registerHibernateType( Types.BINARY, StandardBasicTypes.BINARY.getName() ); registerHibernateType( Types.BIT, StandardBasicTypes.BOOLEAN.getName() ); registerHibernateType( Types.BOOLEAN, StandardBasicTypes.BOOLEAN.getName() ); registerHibernateType( Types.CHAR, StandardBasicTypes.CHARACTER.getName() ); registerHibernateType( Types.CHAR, 1, StandardBasicTypes.CHARACTER.getName() ); registerHibernateType( Types.CHAR, 255, StandardBasicTypes.STRING.getName() ); registerHibernateType( Types.DATE, StandardBasicTypes.DATE.getName() ); registerHibernateType( Types.DOUBLE, StandardBasicTypes.DOUBLE.getName() ); registerHibernateType( Types.FLOAT, StandardBasicTypes.FLOAT.getName() ); registerHibernateType( Types.INTEGER, StandardBasicTypes.INTEGER.getName() ); registerHibernateType( Types.SMALLINT, StandardBasicTypes.SHORT.getName() ); registerHibernateType( Types.TINYINT, StandardBasicTypes.BYTE.getName() ); registerHibernateType( Types.TIME, StandardBasicTypes.TIME.getName() ); registerHibernateType( Types.TIMESTAMP, StandardBasicTypes.TIMESTAMP.getName() ); registerHibernateType( Types.VARCHAR, StandardBasicTypes.STRING.getName() ); registerHibernateType( Types.NVARCHAR, StandardBasicTypes.NSTRING.getName() ); registerHibernateType( Types.VARBINARY, StandardBasicTypes.BINARY.getName() ); registerHibernateType( Types.LONGVARCHAR, StandardBasicTypes.TEXT.getName() ); registerHibernateType( Types.LONGVARBINARY, StandardBasicTypes.IMAGE.getName() ); registerHibernateType( Types.NUMERIC, StandardBasicTypes.BIG_DECIMAL.getName() ); registerHibernateType( Types.DECIMAL, StandardBasicTypes.BIG_DECIMAL.getName() ); registerHibernateType( Types.BLOB, StandardBasicTypes.BLOB.getName() ); registerHibernateType( Types.CLOB, StandardBasicTypes.CLOB.getName() ); registerHibernateType( Types.REAL, StandardBasicTypes.FLOAT.getName() ); if(supportsPartitionBy()) { registerKeyword( "PARTITION" ); } uniqueDelegate = new DefaultUniqueDelegate( this ); }