diff --git a/core/src/main/java/org/hibernate/cfg/Environment.java b/core/src/main/java/org/hibernate/cfg/Environment.java index 4fd6621caa..f657a539d1 100644 --- a/core/src/main/java/org/hibernate/cfg/Environment.java +++ b/core/src/main/java/org/hibernate/cfg/Environment.java @@ -547,6 +547,11 @@ public final class Environment { */ public static final String QUERY_PLAN_CACHE_MAX_SOFT_REFERENCES = "hibernate.query.plan_cache_max_soft_references"; + /** + * Should we not use contextual LOB creation (aka based on {@link java.sql.Connection#createBlob()} et al). + */ + public static final String NON_CONTEXTUAL_LOB_CREATION = "hibernate.jdbc.lob.non_contextual_creation"; + private static final BytecodeProvider BYTECODE_PROVIDER_INSTANCE; private static final boolean ENABLE_BINARY_STREAMS; diff --git a/core/src/main/java/org/hibernate/cfg/SettingsFactory.java b/core/src/main/java/org/hibernate/cfg/SettingsFactory.java index bfd2609b04..2530d3eb50 100644 --- a/core/src/main/java/org/hibernate/cfg/SettingsFactory.java +++ b/core/src/main/java/org/hibernate/cfg/SettingsFactory.java @@ -155,13 +155,14 @@ public class SettingsFactory implements Serializable { settings.setDataDefinitionImplicitCommit( metaReportsDDLCausesTxnCommit ); settings.setDataDefinitionInTransactionSupported( metaReportsDDLInTxnSupported ); settings.setDialect( dialect ); - settings.setJdbcSupport( new JdbcSupport() ); //use dialect default properties final Properties properties = new Properties(); properties.putAll( dialect.getDefaultProperties() ); properties.putAll( props ); + settings.setJdbcSupport( new JdbcSupport( ! PropertiesHelper.getBoolean( Environment.NON_CONTEXTUAL_LOB_CREATION, properties ) ) ); + // Transaction settings: TransactionFactory transactionFactory = createTransactionFactory(properties); diff --git a/core/src/main/java/org/hibernate/dialect/H2Dialect.java b/core/src/main/java/org/hibernate/dialect/H2Dialect.java index 63febc586f..4a9133c23e 100644 --- a/core/src/main/java/org/hibernate/dialect/H2Dialect.java +++ b/core/src/main/java/org/hibernate/dialect/H2Dialect.java @@ -1,348 +1,349 @@ -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * Copyright (c) 2010, Red Hat Inc. or third-party contributors as - * indicated by the @author tags or express copyright attribution - * statements applied by the authors. All third-party contributions are - * distributed under license by Red Hat Inc. - * - * This copyrighted material is made available to anyone wishing to use, modify, - * copy, or redistribute it subject to the terms and conditions of the GNU - * Lesser General Public License, as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this distribution; if not, write to: - * Free Software Foundation, Inc. - * 51 Franklin Street, Fifth Floor - * Boston, MA 02110-1301 USA - */ -package org.hibernate.dialect; - -import java.sql.SQLException; -import java.sql.Types; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import org.hibernate.cfg.Environment; -import org.hibernate.dialect.function.AvgWithArgumentCastFunction; -import org.hibernate.dialect.function.NoArgSQLFunction; -import org.hibernate.dialect.function.StandardSQLFunction; -import org.hibernate.dialect.function.VarArgsSQLFunction; -import org.hibernate.exception.TemplatedViolatedConstraintNameExtracter; -import org.hibernate.exception.ViolatedConstraintNameExtracter; -import org.hibernate.type.StandardBasicTypes; -import org.hibernate.util.ReflectHelper; - -/** - * A dialect compatible with the H2 database. - * - * @author Thomas Mueller - */ -public class H2Dialect extends Dialect { - private static final Logger log = LoggerFactory.getLogger( H2Dialect.class ); - - private String querySequenceString; - - public H2Dialect() { - super(); - - querySequenceString = "select sequence_name from information_schema.sequences"; - try { - // HHH-2300 - final Class constants = ReflectHelper.classForName( "org.h2.engine.Constants" ); - final int majorVersion = ( Integer ) constants.getDeclaredField( "VERSION_MAJOR" ).get( null ); - final int minorVersion = ( Integer ) constants.getDeclaredField( "VERSION_MINOR" ).get( null ); - final int buildId = ( Integer ) constants.getDeclaredField( "BUILD_ID" ).get( null ); - if ( buildId < 32 ) { - querySequenceString = "select name from information_schema.sequences"; - } - if ( !( majorVersion > 1 || minorVersion > 2 || buildId >= 139 ) ) { - log.warn( - "The {} version of H2 implements temporary table creation such that it commits " + - "current transaction; multi-table, bulk hql/jpaql will not work properly", - ( majorVersion + "." + minorVersion + "." + buildId ) - ); - } - } - catch ( Exception e ) { - // ignore (probably H2 not in the classpath) - } - - registerColumnType( Types.BOOLEAN, "boolean" ); - registerColumnType( Types.BIGINT, "bigint" ); - registerColumnType( Types.BINARY, "binary" ); - registerColumnType( Types.BIT, "boolean" ); - registerColumnType( Types.CHAR, "char($l)" ); - registerColumnType( Types.DATE, "date" ); - registerColumnType( Types.DECIMAL, "decimal($p,$s)" ); - registerColumnType( Types.NUMERIC, "decimal($p,$s)" ); - registerColumnType( Types.DOUBLE, "double" ); - registerColumnType( Types.FLOAT, "float" ); - registerColumnType( Types.INTEGER, "integer" ); - registerColumnType( Types.LONGVARBINARY, "longvarbinary" ); - registerColumnType( Types.LONGVARCHAR, "longvarchar" ); - registerColumnType( Types.REAL, "real" ); - registerColumnType( Types.SMALLINT, "smallint" ); - registerColumnType( Types.TINYINT, "tinyint" ); - registerColumnType( Types.TIME, "time" ); - registerColumnType( Types.TIMESTAMP, "timestamp" ); - registerColumnType( Types.VARCHAR, "varchar($l)" ); - registerColumnType( Types.VARBINARY, "binary($l)" ); - registerColumnType( Types.BLOB, "blob" ); - registerColumnType( Types.CLOB, "clob" ); - - // Aggregations ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - registerFunction( "avg", new AvgWithArgumentCastFunction( "double" ) ); - - // select topic, syntax from information_schema.help - // where section like 'Function%' order by section, topic - // - // see also -> http://www.h2database.com/html/functions.html - - // Numeric Functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - registerFunction( "acos", new StandardSQLFunction( "acos", StandardBasicTypes.DOUBLE ) ); - registerFunction( "asin", new StandardSQLFunction( "asin", StandardBasicTypes.DOUBLE ) ); - registerFunction( "atan", new StandardSQLFunction( "atan", StandardBasicTypes.DOUBLE ) ); - registerFunction( "atan2", new StandardSQLFunction( "atan2", StandardBasicTypes.DOUBLE ) ); - registerFunction( "bitand", new StandardSQLFunction( "bitand", StandardBasicTypes.INTEGER ) ); - registerFunction( "bitor", new StandardSQLFunction( "bitor", StandardBasicTypes.INTEGER ) ); - registerFunction( "bitxor", new StandardSQLFunction( "bitxor", StandardBasicTypes.INTEGER ) ); - registerFunction( "ceiling", new StandardSQLFunction( "ceiling", StandardBasicTypes.DOUBLE ) ); - registerFunction( "cos", new StandardSQLFunction( "cos", StandardBasicTypes.DOUBLE ) ); - registerFunction( "compress", new StandardSQLFunction( "compress", StandardBasicTypes.BINARY ) ); - registerFunction( "cot", new StandardSQLFunction( "cot", StandardBasicTypes.DOUBLE ) ); - registerFunction( "decrypt", new StandardSQLFunction( "decrypt", StandardBasicTypes.BINARY ) ); - registerFunction( "degrees", new StandardSQLFunction( "degrees", StandardBasicTypes.DOUBLE ) ); - registerFunction( "encrypt", new StandardSQLFunction( "encrypt", StandardBasicTypes.BINARY ) ); - registerFunction( "exp", new StandardSQLFunction( "exp", StandardBasicTypes.DOUBLE ) ); - registerFunction( "expand", new StandardSQLFunction( "compress", StandardBasicTypes.BINARY ) ); - registerFunction( "floor", new StandardSQLFunction( "floor", StandardBasicTypes.DOUBLE ) ); - registerFunction( "hash", new StandardSQLFunction( "hash", StandardBasicTypes.BINARY ) ); - registerFunction( "log", new StandardSQLFunction( "log", StandardBasicTypes.DOUBLE ) ); - registerFunction( "log10", new StandardSQLFunction( "log10", StandardBasicTypes.DOUBLE ) ); - registerFunction( "pi", new NoArgSQLFunction( "pi", StandardBasicTypes.DOUBLE ) ); - registerFunction( "power", new StandardSQLFunction( "power", StandardBasicTypes.DOUBLE ) ); - registerFunction( "radians", new StandardSQLFunction( "radians", StandardBasicTypes.DOUBLE ) ); - registerFunction( "rand", new NoArgSQLFunction( "rand", StandardBasicTypes.DOUBLE ) ); - registerFunction( "round", new StandardSQLFunction( "round", StandardBasicTypes.DOUBLE ) ); - registerFunction( "roundmagic", new StandardSQLFunction( "roundmagic", StandardBasicTypes.DOUBLE ) ); - registerFunction( "sign", new StandardSQLFunction( "sign", StandardBasicTypes.INTEGER ) ); - registerFunction( "sin", new StandardSQLFunction( "sin", StandardBasicTypes.DOUBLE ) ); - registerFunction( "tan", new StandardSQLFunction( "tan", StandardBasicTypes.DOUBLE ) ); - registerFunction( "truncate", new StandardSQLFunction( "truncate", StandardBasicTypes.DOUBLE ) ); - - // String Functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - registerFunction( "ascii", new StandardSQLFunction( "ascii", StandardBasicTypes.INTEGER ) ); - registerFunction( "char", new StandardSQLFunction( "char", StandardBasicTypes.CHARACTER ) ); - registerFunction( "concat", new VarArgsSQLFunction( StandardBasicTypes.STRING, "(", "||", ")" ) ); - registerFunction( "difference", new StandardSQLFunction( "difference", StandardBasicTypes.INTEGER ) ); - registerFunction( "hextoraw", new StandardSQLFunction( "hextoraw", StandardBasicTypes.STRING ) ); - registerFunction( "insert", new StandardSQLFunction( "lower", StandardBasicTypes.STRING ) ); - registerFunction( "left", new StandardSQLFunction( "left", StandardBasicTypes.STRING ) ); - registerFunction( "lcase", new StandardSQLFunction( "lcase", StandardBasicTypes.STRING ) ); - registerFunction( "ltrim", new StandardSQLFunction( "ltrim", StandardBasicTypes.STRING ) ); - registerFunction( "octet_length", new StandardSQLFunction( "octet_length", StandardBasicTypes.INTEGER ) ); - registerFunction( "position", new StandardSQLFunction( "position", StandardBasicTypes.INTEGER ) ); - registerFunction( "rawtohex", new StandardSQLFunction( "rawtohex", StandardBasicTypes.STRING ) ); - registerFunction( "repeat", new StandardSQLFunction( "repeat", StandardBasicTypes.STRING ) ); - registerFunction( "replace", new StandardSQLFunction( "replace", StandardBasicTypes.STRING ) ); - registerFunction( "right", new StandardSQLFunction( "right", StandardBasicTypes.STRING ) ); - registerFunction( "rtrim", new StandardSQLFunction( "rtrim", StandardBasicTypes.STRING ) ); - registerFunction( "soundex", new StandardSQLFunction( "soundex", StandardBasicTypes.STRING ) ); - registerFunction( "space", new StandardSQLFunction( "space", StandardBasicTypes.STRING ) ); - registerFunction( "stringencode", new StandardSQLFunction( "stringencode", StandardBasicTypes.STRING ) ); - registerFunction( "stringdecode", new StandardSQLFunction( "stringdecode", StandardBasicTypes.STRING ) ); - registerFunction( "stringtoutf8", new StandardSQLFunction( "stringtoutf8", StandardBasicTypes.BINARY ) ); - registerFunction( "ucase", new StandardSQLFunction( "ucase", StandardBasicTypes.STRING ) ); - registerFunction( "utf8tostring", new StandardSQLFunction( "utf8tostring", StandardBasicTypes.STRING ) ); - - // Time and Date Functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - registerFunction( "curdate", new NoArgSQLFunction( "curdate", StandardBasicTypes.DATE ) ); - registerFunction( "curtime", new NoArgSQLFunction( "curtime", StandardBasicTypes.TIME ) ); - registerFunction( "curtimestamp", new NoArgSQLFunction( "curtimestamp", StandardBasicTypes.TIME ) ); - registerFunction( "current_date", new NoArgSQLFunction( "current_date", StandardBasicTypes.DATE ) ); - registerFunction( "current_time", new NoArgSQLFunction( "current_time", StandardBasicTypes.TIME ) ); - registerFunction( "current_timestamp", new NoArgSQLFunction( "current_timestamp", StandardBasicTypes.TIMESTAMP ) ); - registerFunction( "datediff", new StandardSQLFunction( "datediff", StandardBasicTypes.INTEGER ) ); - registerFunction( "dayname", new StandardSQLFunction( "dayname", StandardBasicTypes.STRING ) ); - registerFunction( "dayofmonth", new StandardSQLFunction( "dayofmonth", StandardBasicTypes.INTEGER ) ); - registerFunction( "dayofweek", new StandardSQLFunction( "dayofweek", StandardBasicTypes.INTEGER ) ); - registerFunction( "dayofyear", new StandardSQLFunction( "dayofyear", StandardBasicTypes.INTEGER ) ); - registerFunction( "monthname", new StandardSQLFunction( "monthname", StandardBasicTypes.STRING ) ); - registerFunction( "now", new NoArgSQLFunction( "now", StandardBasicTypes.TIMESTAMP ) ); - registerFunction( "quarter", new StandardSQLFunction( "quarter", StandardBasicTypes.INTEGER ) ); - registerFunction( "week", new StandardSQLFunction( "week", StandardBasicTypes.INTEGER ) ); - - // System Functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - registerFunction( "database", new NoArgSQLFunction( "database", StandardBasicTypes.STRING ) ); - registerFunction( "user", new NoArgSQLFunction( "user", StandardBasicTypes.STRING ) ); - - getDefaultProperties().setProperty( Environment.STATEMENT_BATCH_SIZE, DEFAULT_BATCH_SIZE ); - } - - public String getAddColumnString() { - return "add column"; - } - - public boolean supportsIdentityColumns() { - return true; - } - - public String getIdentityColumnString() { - return "generated by default as identity"; // not null is implicit - } - - public String getIdentitySelectString() { - return "call identity()"; - } - - public String getIdentityInsertString() { - return "null"; - } - - public String getForUpdateString() { - return " for update"; - } - - public boolean supportsUnique() { - return true; - } - - public boolean supportsLimit() { - return true; - } - - public String getLimitString(String sql, boolean hasOffset) { - return new StringBuffer( sql.length() + 20 ) - .append( sql ) - .append( hasOffset ? " limit ? offset ?" : " limit ?" ) - .toString(); - } - - public boolean bindLimitParametersInReverseOrder() { - return true; - } - - public boolean bindLimitParametersFirst() { - return false; - } - - public boolean supportsIfExistsAfterTableName() { - return true; - } - - public boolean supportsSequences() { - return true; - } - - public boolean supportsPooledSequences() { - return true; - } - - public String getCreateSequenceString(String sequenceName) { - return "create sequence " + sequenceName; - } - - public String getDropSequenceString(String sequenceName) { - return "drop sequence " + sequenceName; - } - - public String getSelectSequenceNextValString(String sequenceName) { - return "next value for " + sequenceName; - } - - public String getSequenceNextValString(String sequenceName) { - return "call next value for " + sequenceName; - } - - public String getQuerySequencesString() { - return querySequenceString; - } - - public ViolatedConstraintNameExtracter getViolatedConstraintNameExtracter() { - return EXTRACTER; - } - - private static ViolatedConstraintNameExtracter EXTRACTER = new TemplatedViolatedConstraintNameExtracter() { - /** - * Extract the name of the violated constraint from the given SQLException. - * - * @param sqle The exception that was the result of the constraint violation. - * @return The extracted constraint name. - */ - public String extractConstraintName(SQLException sqle) { - String constraintName = null; - // 23000: Check constraint violation: {0} - // 23001: Unique index or primary key violation: {0} - if ( sqle.getSQLState().startsWith( "23" ) ) { - final String message = sqle.getMessage(); - int idx = message.indexOf( "violation: " ); - if ( idx > 0 ) { - constraintName = message.substring( idx + "violation: ".length() ); - } - } - return constraintName; - } - }; - - @Override - public boolean supportsTemporaryTables() { - return true; - } - - @Override - public String getCreateTemporaryTableString() { - return "create local temporary table if not exists"; - } - - @Override - public Boolean performTemporaryTableDDLInIsolation() { - return Boolean.FALSE; - } - - @Override - public boolean dropTemporaryTableAfterUse() { - return false; - } - - public boolean supportsCurrentTimestampSelection() { - return true; - } - - public boolean isCurrentTimestampSelectStringCallable() { - return false; - } - - public String getCurrentTimestampSelectString() { - return "call current_timestamp()"; - } - - public boolean supportsUnionAll() { - return true; - } - - - // Overridden informational metadata ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - @Override - public boolean supportsLobValueChangePropogation() { - return false; - } - - @Override - public boolean supportsTupleDistinctCounts() { - return false; - } - - @Override - public boolean doesReadCommittedCauseWritersToBlockReaders() { - // see http://groups.google.com/group/h2-database/browse_thread/thread/562d8a49e2dabe99?hl=en - return true; - } -} +/* + * Hibernate, Relational Persistence for Idiomatic Java + * + * Copyright (c) 2010, Red Hat Inc. or third-party contributors as + * indicated by the @author tags or express copyright attribution + * statements applied by the authors. All third-party contributions are + * distributed under license by Red Hat Inc. + * + * This copyrighted material is made available to anyone wishing to use, modify, + * copy, or redistribute it subject to the terms and conditions of the GNU + * Lesser General Public License, as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this distribution; if not, write to: + * Free Software Foundation, Inc. + * 51 Franklin Street, Fifth Floor + * Boston, MA 02110-1301 USA + */ +package org.hibernate.dialect; + +import java.sql.SQLException; +import java.sql.Types; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import org.hibernate.cfg.Environment; +import org.hibernate.dialect.function.AvgWithArgumentCastFunction; +import org.hibernate.dialect.function.NoArgSQLFunction; +import org.hibernate.dialect.function.StandardSQLFunction; +import org.hibernate.dialect.function.VarArgsSQLFunction; +import org.hibernate.exception.TemplatedViolatedConstraintNameExtracter; +import org.hibernate.exception.ViolatedConstraintNameExtracter; +import org.hibernate.type.StandardBasicTypes; +import org.hibernate.util.ReflectHelper; + +/** + * A dialect compatible with the H2 database. + * + * @author Thomas Mueller + */ +public class H2Dialect extends Dialect { + private static final Logger log = LoggerFactory.getLogger( H2Dialect.class ); + + private String querySequenceString; + + public H2Dialect() { + super(); + + querySequenceString = "select sequence_name from information_schema.sequences"; + try { + // HHH-2300 + final Class constants = ReflectHelper.classForName( "org.h2.engine.Constants" ); + final int majorVersion = ( Integer ) constants.getDeclaredField( "VERSION_MAJOR" ).get( null ); + final int minorVersion = ( Integer ) constants.getDeclaredField( "VERSION_MINOR" ).get( null ); + final int buildId = ( Integer ) constants.getDeclaredField( "BUILD_ID" ).get( null ); + if ( buildId < 32 ) { + querySequenceString = "select name from information_schema.sequences"; + } + if ( !( majorVersion > 1 || minorVersion > 2 || buildId >= 139 ) ) { + log.warn( + "The {} version of H2 implements temporary table creation such that it commits " + + "current transaction; multi-table, bulk hql/jpaql will not work properly", + ( majorVersion + "." + minorVersion + "." + buildId ) + ); + } + } + catch ( Exception e ) { + // ignore (probably H2 not in the classpath) + } + + registerColumnType( Types.BOOLEAN, "boolean" ); + registerColumnType( Types.BIGINT, "bigint" ); + registerColumnType( Types.BINARY, "binary" ); + registerColumnType( Types.BIT, "boolean" ); + registerColumnType( Types.CHAR, "char($l)" ); + registerColumnType( Types.DATE, "date" ); + registerColumnType( Types.DECIMAL, "decimal($p,$s)" ); + registerColumnType( Types.NUMERIC, "decimal($p,$s)" ); + registerColumnType( Types.DOUBLE, "double" ); + registerColumnType( Types.FLOAT, "float" ); + registerColumnType( Types.INTEGER, "integer" ); + registerColumnType( Types.LONGVARBINARY, "longvarbinary" ); + registerColumnType( Types.LONGVARCHAR, "longvarchar" ); + registerColumnType( Types.REAL, "real" ); + registerColumnType( Types.SMALLINT, "smallint" ); + registerColumnType( Types.TINYINT, "tinyint" ); + registerColumnType( Types.TIME, "time" ); + registerColumnType( Types.TIMESTAMP, "timestamp" ); + registerColumnType( Types.VARCHAR, "varchar($l)" ); + registerColumnType( Types.VARBINARY, "binary($l)" ); + registerColumnType( Types.BLOB, "blob" ); + registerColumnType( Types.CLOB, "clob" ); + + // Aggregations ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + registerFunction( "avg", new AvgWithArgumentCastFunction( "double" ) ); + + // select topic, syntax from information_schema.help + // where section like 'Function%' order by section, topic + // + // see also -> http://www.h2database.com/html/functions.html + + // Numeric Functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + registerFunction( "acos", new StandardSQLFunction( "acos", StandardBasicTypes.DOUBLE ) ); + registerFunction( "asin", new StandardSQLFunction( "asin", StandardBasicTypes.DOUBLE ) ); + registerFunction( "atan", new StandardSQLFunction( "atan", StandardBasicTypes.DOUBLE ) ); + registerFunction( "atan2", new StandardSQLFunction( "atan2", StandardBasicTypes.DOUBLE ) ); + registerFunction( "bitand", new StandardSQLFunction( "bitand", StandardBasicTypes.INTEGER ) ); + registerFunction( "bitor", new StandardSQLFunction( "bitor", StandardBasicTypes.INTEGER ) ); + registerFunction( "bitxor", new StandardSQLFunction( "bitxor", StandardBasicTypes.INTEGER ) ); + registerFunction( "ceiling", new StandardSQLFunction( "ceiling", StandardBasicTypes.DOUBLE ) ); + registerFunction( "cos", new StandardSQLFunction( "cos", StandardBasicTypes.DOUBLE ) ); + registerFunction( "compress", new StandardSQLFunction( "compress", StandardBasicTypes.BINARY ) ); + registerFunction( "cot", new StandardSQLFunction( "cot", StandardBasicTypes.DOUBLE ) ); + registerFunction( "decrypt", new StandardSQLFunction( "decrypt", StandardBasicTypes.BINARY ) ); + registerFunction( "degrees", new StandardSQLFunction( "degrees", StandardBasicTypes.DOUBLE ) ); + registerFunction( "encrypt", new StandardSQLFunction( "encrypt", StandardBasicTypes.BINARY ) ); + registerFunction( "exp", new StandardSQLFunction( "exp", StandardBasicTypes.DOUBLE ) ); + registerFunction( "expand", new StandardSQLFunction( "compress", StandardBasicTypes.BINARY ) ); + registerFunction( "floor", new StandardSQLFunction( "floor", StandardBasicTypes.DOUBLE ) ); + registerFunction( "hash", new StandardSQLFunction( "hash", StandardBasicTypes.BINARY ) ); + registerFunction( "log", new StandardSQLFunction( "log", StandardBasicTypes.DOUBLE ) ); + registerFunction( "log10", new StandardSQLFunction( "log10", StandardBasicTypes.DOUBLE ) ); + registerFunction( "pi", new NoArgSQLFunction( "pi", StandardBasicTypes.DOUBLE ) ); + registerFunction( "power", new StandardSQLFunction( "power", StandardBasicTypes.DOUBLE ) ); + registerFunction( "radians", new StandardSQLFunction( "radians", StandardBasicTypes.DOUBLE ) ); + registerFunction( "rand", new NoArgSQLFunction( "rand", StandardBasicTypes.DOUBLE ) ); + registerFunction( "round", new StandardSQLFunction( "round", StandardBasicTypes.DOUBLE ) ); + registerFunction( "roundmagic", new StandardSQLFunction( "roundmagic", StandardBasicTypes.DOUBLE ) ); + registerFunction( "sign", new StandardSQLFunction( "sign", StandardBasicTypes.INTEGER ) ); + registerFunction( "sin", new StandardSQLFunction( "sin", StandardBasicTypes.DOUBLE ) ); + registerFunction( "tan", new StandardSQLFunction( "tan", StandardBasicTypes.DOUBLE ) ); + registerFunction( "truncate", new StandardSQLFunction( "truncate", StandardBasicTypes.DOUBLE ) ); + + // String Functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + registerFunction( "ascii", new StandardSQLFunction( "ascii", StandardBasicTypes.INTEGER ) ); + registerFunction( "char", new StandardSQLFunction( "char", StandardBasicTypes.CHARACTER ) ); + registerFunction( "concat", new VarArgsSQLFunction( StandardBasicTypes.STRING, "(", "||", ")" ) ); + registerFunction( "difference", new StandardSQLFunction( "difference", StandardBasicTypes.INTEGER ) ); + registerFunction( "hextoraw", new StandardSQLFunction( "hextoraw", StandardBasicTypes.STRING ) ); + registerFunction( "insert", new StandardSQLFunction( "lower", StandardBasicTypes.STRING ) ); + registerFunction( "left", new StandardSQLFunction( "left", StandardBasicTypes.STRING ) ); + registerFunction( "lcase", new StandardSQLFunction( "lcase", StandardBasicTypes.STRING ) ); + registerFunction( "ltrim", new StandardSQLFunction( "ltrim", StandardBasicTypes.STRING ) ); + registerFunction( "octet_length", new StandardSQLFunction( "octet_length", StandardBasicTypes.INTEGER ) ); + registerFunction( "position", new StandardSQLFunction( "position", StandardBasicTypes.INTEGER ) ); + registerFunction( "rawtohex", new StandardSQLFunction( "rawtohex", StandardBasicTypes.STRING ) ); + registerFunction( "repeat", new StandardSQLFunction( "repeat", StandardBasicTypes.STRING ) ); + registerFunction( "replace", new StandardSQLFunction( "replace", StandardBasicTypes.STRING ) ); + registerFunction( "right", new StandardSQLFunction( "right", StandardBasicTypes.STRING ) ); + registerFunction( "rtrim", new StandardSQLFunction( "rtrim", StandardBasicTypes.STRING ) ); + registerFunction( "soundex", new StandardSQLFunction( "soundex", StandardBasicTypes.STRING ) ); + registerFunction( "space", new StandardSQLFunction( "space", StandardBasicTypes.STRING ) ); + registerFunction( "stringencode", new StandardSQLFunction( "stringencode", StandardBasicTypes.STRING ) ); + registerFunction( "stringdecode", new StandardSQLFunction( "stringdecode", StandardBasicTypes.STRING ) ); + registerFunction( "stringtoutf8", new StandardSQLFunction( "stringtoutf8", StandardBasicTypes.BINARY ) ); + registerFunction( "ucase", new StandardSQLFunction( "ucase", StandardBasicTypes.STRING ) ); + registerFunction( "utf8tostring", new StandardSQLFunction( "utf8tostring", StandardBasicTypes.STRING ) ); + + // Time and Date Functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + registerFunction( "curdate", new NoArgSQLFunction( "curdate", StandardBasicTypes.DATE ) ); + registerFunction( "curtime", new NoArgSQLFunction( "curtime", StandardBasicTypes.TIME ) ); + registerFunction( "curtimestamp", new NoArgSQLFunction( "curtimestamp", StandardBasicTypes.TIME ) ); + registerFunction( "current_date", new NoArgSQLFunction( "current_date", StandardBasicTypes.DATE ) ); + registerFunction( "current_time", new NoArgSQLFunction( "current_time", StandardBasicTypes.TIME ) ); + registerFunction( "current_timestamp", new NoArgSQLFunction( "current_timestamp", StandardBasicTypes.TIMESTAMP ) ); + registerFunction( "datediff", new StandardSQLFunction( "datediff", StandardBasicTypes.INTEGER ) ); + registerFunction( "dayname", new StandardSQLFunction( "dayname", StandardBasicTypes.STRING ) ); + registerFunction( "dayofmonth", new StandardSQLFunction( "dayofmonth", StandardBasicTypes.INTEGER ) ); + registerFunction( "dayofweek", new StandardSQLFunction( "dayofweek", StandardBasicTypes.INTEGER ) ); + registerFunction( "dayofyear", new StandardSQLFunction( "dayofyear", StandardBasicTypes.INTEGER ) ); + registerFunction( "monthname", new StandardSQLFunction( "monthname", StandardBasicTypes.STRING ) ); + registerFunction( "now", new NoArgSQLFunction( "now", StandardBasicTypes.TIMESTAMP ) ); + registerFunction( "quarter", new StandardSQLFunction( "quarter", StandardBasicTypes.INTEGER ) ); + registerFunction( "week", new StandardSQLFunction( "week", StandardBasicTypes.INTEGER ) ); + + // System Functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + registerFunction( "database", new NoArgSQLFunction( "database", StandardBasicTypes.STRING ) ); + registerFunction( "user", new NoArgSQLFunction( "user", StandardBasicTypes.STRING ) ); + + getDefaultProperties().setProperty( Environment.STATEMENT_BATCH_SIZE, DEFAULT_BATCH_SIZE ); + getDefaultProperties().setProperty( Environment.NON_CONTEXTUAL_LOB_CREATION, "true" ); // http://code.google.com/p/h2database/issues/detail?id=235 + } + + public String getAddColumnString() { + return "add column"; + } + + public boolean supportsIdentityColumns() { + return true; + } + + public String getIdentityColumnString() { + return "generated by default as identity"; // not null is implicit + } + + public String getIdentitySelectString() { + return "call identity()"; + } + + public String getIdentityInsertString() { + return "null"; + } + + public String getForUpdateString() { + return " for update"; + } + + public boolean supportsUnique() { + return true; + } + + public boolean supportsLimit() { + return true; + } + + public String getLimitString(String sql, boolean hasOffset) { + return new StringBuffer( sql.length() + 20 ) + .append( sql ) + .append( hasOffset ? " limit ? offset ?" : " limit ?" ) + .toString(); + } + + public boolean bindLimitParametersInReverseOrder() { + return true; + } + + public boolean bindLimitParametersFirst() { + return false; + } + + public boolean supportsIfExistsAfterTableName() { + return true; + } + + public boolean supportsSequences() { + return true; + } + + public boolean supportsPooledSequences() { + return true; + } + + public String getCreateSequenceString(String sequenceName) { + return "create sequence " + sequenceName; + } + + public String getDropSequenceString(String sequenceName) { + return "drop sequence " + sequenceName; + } + + public String getSelectSequenceNextValString(String sequenceName) { + return "next value for " + sequenceName; + } + + public String getSequenceNextValString(String sequenceName) { + return "call next value for " + sequenceName; + } + + public String getQuerySequencesString() { + return querySequenceString; + } + + public ViolatedConstraintNameExtracter getViolatedConstraintNameExtracter() { + return EXTRACTER; + } + + private static ViolatedConstraintNameExtracter EXTRACTER = new TemplatedViolatedConstraintNameExtracter() { + /** + * Extract the name of the violated constraint from the given SQLException. + * + * @param sqle The exception that was the result of the constraint violation. + * @return The extracted constraint name. + */ + public String extractConstraintName(SQLException sqle) { + String constraintName = null; + // 23000: Check constraint violation: {0} + // 23001: Unique index or primary key violation: {0} + if ( sqle.getSQLState().startsWith( "23" ) ) { + final String message = sqle.getMessage(); + int idx = message.indexOf( "violation: " ); + if ( idx > 0 ) { + constraintName = message.substring( idx + "violation: ".length() ); + } + } + return constraintName; + } + }; + + @Override + public boolean supportsTemporaryTables() { + return true; + } + + @Override + public String getCreateTemporaryTableString() { + return "create local temporary table if not exists"; + } + + @Override + public Boolean performTemporaryTableDDLInIsolation() { + return Boolean.FALSE; + } + + @Override + public boolean dropTemporaryTableAfterUse() { + return false; + } + + public boolean supportsCurrentTimestampSelection() { + return true; + } + + public boolean isCurrentTimestampSelectStringCallable() { + return false; + } + + public String getCurrentTimestampSelectString() { + return "call current_timestamp()"; + } + + public boolean supportsUnionAll() { + return true; + } + + + // Overridden informational metadata ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + @Override + public boolean supportsLobValueChangePropogation() { + return false; + } + + @Override + public boolean supportsTupleDistinctCounts() { + return false; + } + + @Override + public boolean doesReadCommittedCauseWritersToBlockReaders() { + // see http://groups.google.com/group/h2-database/browse_thread/thread/562d8a49e2dabe99?hl=en + return true; + } +} diff --git a/core/src/main/java/org/hibernate/engine/jdbc/JdbcSupport.java b/core/src/main/java/org/hibernate/engine/jdbc/JdbcSupport.java index 2527d7b38a..0dd2999bfc 100644 --- a/core/src/main/java/org/hibernate/engine/jdbc/JdbcSupport.java +++ b/core/src/main/java/org/hibernate/engine/jdbc/JdbcSupport.java @@ -31,14 +31,48 @@ import java.sql.ResultSet; * @author Steve Ebersole */ public class JdbcSupport { + public final boolean userContextualLobCreator; + + /** + * Create a support object + * + * @param userContextualLobCreator Should we use contextual (using the JDBC {@link java.sql.Connection}) to + * create LOB instances. In almost all instances this should be the case. However if the underlying driver + * does not support the {@link java.sql.Connection#createBlob()}, {@link java.sql.Connection#createClob()} or + * {@link java.sql.Connection#createNClob()} methods this will need to be set to false. + */ + public JdbcSupport(boolean userContextualLobCreator) { + this.userContextualLobCreator = userContextualLobCreator; + } + + /** + * Get an explcitly non-contextual LOB creator. + * + * @return The LOB creator + */ public LobCreator getLobCreator() { return NonContextualLobCreator.INSTANCE; } + /** + * Get a LOB creator, based on the given context + * + * @return The LOB creator + */ public LobCreator getLobCreator(LobCreationContext lobCreationContext) { - return new ContextualLobCreator( lobCreationContext ); + return userContextualLobCreator + ? new ContextualLobCreator( lobCreationContext ) + : NonContextualLobCreator.INSTANCE; } + /** + * Wrap a result set in a "colun name cache" wrapper. + * + * @param resultSet The result set to wrap + * @param columnNameCache The column name cache. + * + * @return The wrapped result set. + */ public ResultSet wrap(ResultSet resultSet, ColumnNameCache columnNameCache) { return ResultSetWrapperProxy.generateProxy( resultSet, columnNameCache ); } diff --git a/core/src/test/java/org/hibernate/jdbc/JdbcSupportTest.java b/core/src/test/java/org/hibernate/jdbc/JdbcSupportTest.java index 134469fdca..6fee8bfcbc 100644 --- a/core/src/test/java/org/hibernate/jdbc/JdbcSupportTest.java +++ b/core/src/test/java/org/hibernate/jdbc/JdbcSupportTest.java @@ -1,10 +1,10 @@ /* * Hibernate, Relational Persistence for Idiomatic Java * - * Copyright (c) 2009 by Red Hat Inc and/or its affiliates or by - * third-party contributors as indicated by either @author tags or express - * copyright attribution statements applied by the authors. All - * third-party contributions are distributed under license by Red Hat Inc. + * Copyright (c) 2010, Red Hat Inc. or third-party contributors as + * indicated by the @author tags or express copyright attribution + * statements applied by the authors. All third-party contributions are + * distributed under license by Red Hat Inc. * * This copyrighted material is made available to anyone wishing to use, modify, * copy, or redistribute it subject to the terms and conditions of the GNU @@ -41,7 +41,6 @@ import org.hibernate.engine.jdbc.ContextualLobCreator; import org.hibernate.engine.jdbc.BlobImplementer; import org.hibernate.engine.jdbc.ClobImplementer; import org.hibernate.engine.jdbc.NClobImplementer; -import org.hibernate.engine.jdbc.NonContextualLobCreator; import org.hibernate.engine.jdbc.WrappedBlob; import org.hibernate.engine.jdbc.WrappedClob; @@ -51,7 +50,7 @@ import org.hibernate.engine.jdbc.WrappedClob; * @author Steve Ebersole */ public class JdbcSupportTest extends TestCase { - private static JdbcSupport jdbcSupport = new JdbcSupport(); + private static JdbcSupport jdbcSupport = new JdbcSupport( true ); public void testConnectedLobCreator() throws SQLException { final Connection connection = createConnectionProxy( diff --git a/entitymanager/src/test/java/org/hibernate/ejb/test/lob/BlobTest.java b/entitymanager/src/test/java/org/hibernate/ejb/test/lob/BlobTest.java index 5abeec3085..319ed39b73 100644 --- a/entitymanager/src/test/java/org/hibernate/ejb/test/lob/BlobTest.java +++ b/entitymanager/src/test/java/org/hibernate/ejb/test/lob/BlobTest.java @@ -10,6 +10,7 @@ import java.util.Map; import javax.persistence.EntityManager; import org.hibernate.Hibernate; +import org.hibernate.Session; import org.hibernate.dialect.Dialect; import org.hibernate.ejb.test.TestCase; @@ -28,7 +29,7 @@ public class BlobTest extends TestCase { ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream( baos ); oos.writeObject( image ); - reader.setImage( (Blob) Hibernate.createBlob( baos.toByteArray() ) ); + reader.setImage( em.unwrap( Session.class ).getLobHelper().createBlob( baos.toByteArray() ) ); em.persist( reader ); em.getTransaction().commit(); em.close(); //useless but y'a know diff --git a/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/allAudited/AbstractAllAuditedTest.java b/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/allAudited/AbstractAllAuditedTest.java index 221e7df8a8..39343974d9 100644 --- a/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/allAudited/AbstractAllAuditedTest.java +++ b/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/allAudited/AbstractAllAuditedTest.java @@ -11,11 +11,10 @@ import org.testng.Assert; import java.util.Arrays; /** - * @author Hernán Chanfreau + * @author Hern�n Chanfreau * @author Adam Warski (adam at warski dot org) */ public abstract class AbstractAllAuditedTest extends AbstractEntityTest { - private long ai_id; private long nai_id; @@ -73,7 +72,7 @@ public abstract class AbstractAllAuditedTest extends AbstractEntityTest { SimpleInterface si = getEntityManager().find(SimpleInterface.class, ai_id); assert si != null; - // levanto las de la revisión 1, ninguna debe ser null + // levanto las de la revisi�n 1, ninguna debe ser null AuditedImplementor ai_rev1 = getAuditReader().find(AuditedImplementor.class, ai_id, 1); assert ai_rev1 != null; SimpleInterface si_rev1 = getAuditReader().find(SimpleInterface.class, ai_id, 1); diff --git a/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/allAudited/AuditedImplementor.java b/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/allAudited/AuditedImplementor.java index f8ad99cc39..e504709341 100644 --- a/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/allAudited/AuditedImplementor.java +++ b/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/allAudited/AuditedImplementor.java @@ -3,21 +3,16 @@ package org.hibernate.envers.test.integration.interfaces.hbm.allAudited; import org.hibernate.envers.Audited; /** - * @author Hernán Chanfreau + * @author Hern�n Chanfreau * */ @Audited public class AuditedImplementor implements SimpleInterface { - private long id; - private String data; - private String auditedImplementorData; - protected AuditedImplementor() { - } public long getId() { diff --git a/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/allAudited/NonAuditedImplementor.java b/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/allAudited/NonAuditedImplementor.java index 0d3952d1fd..d484b9cb7a 100644 --- a/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/allAudited/NonAuditedImplementor.java +++ b/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/allAudited/NonAuditedImplementor.java @@ -2,20 +2,15 @@ package org.hibernate.envers.test.integration.interfaces.hbm.allAudited; /** - * @author Hernán Chanfreau + * @author Hern�n Chanfreau * */ public class NonAuditedImplementor implements SimpleInterface { - private long id; - private String data; - private String nonAuditedImplementorData; - protected NonAuditedImplementor() { - } public long getId() { diff --git a/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/allAudited/SimpleInterface.java b/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/allAudited/SimpleInterface.java index 3b69bcc60f..f20e7945bc 100644 --- a/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/allAudited/SimpleInterface.java +++ b/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/allAudited/SimpleInterface.java @@ -3,7 +3,7 @@ package org.hibernate.envers.test.integration.interfaces.hbm.allAudited; import org.hibernate.envers.Audited; /** - * @author Hernán Chanfreau + * @author Hern�n Chanfreau * */ @Audited diff --git a/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/allAudited/joined/JoinedAllAuditedTest.java b/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/allAudited/joined/JoinedAllAuditedTest.java index 4b6bda6b2b..08f2051da0 100644 --- a/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/allAudited/joined/JoinedAllAuditedTest.java +++ b/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/allAudited/joined/JoinedAllAuditedTest.java @@ -9,8 +9,7 @@ import org.hibernate.envers.test.integration.interfaces.hbm.allAudited.AbstractA import org.testng.annotations.Test; /** - * @author Hernán Chanfreau - * + * @author Hern�n Chanfreau */ public class JoinedAllAuditedTest extends AbstractAllAuditedTest { diff --git a/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/allAudited/subclass/SubclassAllAuditedTest.java b/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/allAudited/subclass/SubclassAllAuditedTest.java index 96bcb9579d..3789016820 100644 --- a/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/allAudited/subclass/SubclassAllAuditedTest.java +++ b/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/allAudited/subclass/SubclassAllAuditedTest.java @@ -9,8 +9,7 @@ import org.hibernate.envers.test.integration.interfaces.hbm.allAudited.AbstractA import org.testng.annotations.Test; /** - * @author Hernán Chanfreau - * + * @author Hern�n Chanfreau */ public class SubclassAllAuditedTest extends AbstractAllAuditedTest { diff --git a/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/allAudited/union/UnionAllAuditedTest.java b/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/allAudited/union/UnionAllAuditedTest.java index 22cf325bed..3c3370e2c4 100644 --- a/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/allAudited/union/UnionAllAuditedTest.java +++ b/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/allAudited/union/UnionAllAuditedTest.java @@ -9,8 +9,7 @@ import org.hibernate.envers.test.integration.interfaces.hbm.allAudited.AbstractA import org.testng.annotations.Test; /** - * @author Hernán Chanfreau - * + * @author Hern�n Chanfreau */ public class UnionAllAuditedTest extends AbstractAllAuditedTest { diff --git a/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/propertiesAudited/AbstractPropertiesAuditedTest.java b/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/propertiesAudited/AbstractPropertiesAuditedTest.java index 9f75e84a68..c1a32d24d0 100644 --- a/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/propertiesAudited/AbstractPropertiesAuditedTest.java +++ b/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/propertiesAudited/AbstractPropertiesAuditedTest.java @@ -8,12 +8,10 @@ import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; /** - * @author Hernán Chanfreau + * @author Hern�n Chanfreau * */ - public abstract class AbstractPropertiesAuditedTest extends AbstractEntityTest { - private long ai_id; private long nai_id; @@ -60,7 +58,7 @@ public abstract class AbstractPropertiesAuditedTest extends AbstractEntityTest { ai_id); assert si != null; - // levanto las de la revisión 1, ninguna debe ser null + // levanto las de la revisi�n 1, ninguna debe ser null AuditedImplementor ai_rev1 = getAuditReader().find( AuditedImplementor.class, ai_id, 1); assert ai_rev1 != null; @@ -71,10 +69,10 @@ public abstract class AbstractPropertiesAuditedTest extends AbstractEntityTest { // data de las actuales no debe ser null assert ai.getData() != null; assert si.getData() != null; - // data de las revisiones No está auditada + // data de las revisiones No est� auditada assert ai_rev1.getData() == null; assert si_rev1.getData() == null; - // numerito de las revisiones está auditada, debe ser igual a NUMERITO + // numerito de las revisiones est� auditada, debe ser igual a NUMERITO assert ai_rev1.getNumerito() == NUMERITO; assert si_rev1.getNumerito() == NUMERITO; } diff --git a/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/propertiesAudited/AuditedImplementor.java b/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/propertiesAudited/AuditedImplementor.java index b8869dcb14..a2ca411c4e 100644 --- a/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/propertiesAudited/AuditedImplementor.java +++ b/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/propertiesAudited/AuditedImplementor.java @@ -3,24 +3,17 @@ package org.hibernate.envers.test.integration.interfaces.hbm.propertiesAudited; import org.hibernate.envers.Audited; /** - * @author Hernán Chanfreau + * @author Hern�n Chanfreau * */ - @Audited public class AuditedImplementor implements SimpleInterface { - private long id; - private String data; - private String auditedImplementorData; - private int numerito; - protected AuditedImplementor() { - } public long getId() { diff --git a/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/propertiesAudited/NonAuditedImplementor.java b/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/propertiesAudited/NonAuditedImplementor.java index 4bd2f55496..a5eedf3294 100644 --- a/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/propertiesAudited/NonAuditedImplementor.java +++ b/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/propertiesAudited/NonAuditedImplementor.java @@ -1,23 +1,15 @@ package org.hibernate.envers.test.integration.interfaces.hbm.propertiesAudited; /** - * @author Hernán Chanfreau - * + * @author Hern�n Chanfreau */ - public class NonAuditedImplementor implements SimpleInterface { - private long id; - private String data; - private String nonAuditedImplementorData; - private int numerito; - protected NonAuditedImplementor() { - } public long getId() { @@ -43,7 +35,7 @@ public class NonAuditedImplementor implements SimpleInterface { public void setNonAuditedImplementorData(String implementorData) { this.nonAuditedImplementorData = implementorData; } - + public int getNumerito() { return numerito; } diff --git a/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/propertiesAudited/SimpleInterface.java b/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/propertiesAudited/SimpleInterface.java index 50525fbafa..72470c7717 100644 --- a/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/propertiesAudited/SimpleInterface.java +++ b/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/propertiesAudited/SimpleInterface.java @@ -3,10 +3,9 @@ package org.hibernate.envers.test.integration.interfaces.hbm.propertiesAudited; import org.hibernate.envers.Audited; /** - * @author Hernán Chanfreau + * @author Hern�n Chanfreau * */ - public interface SimpleInterface { long getId(); diff --git a/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/propertiesAudited/joined/JoinedPropertiesAuditedTest.java b/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/propertiesAudited/joined/JoinedPropertiesAuditedTest.java index c334437221..10d22eb8ed 100644 --- a/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/propertiesAudited/joined/JoinedPropertiesAuditedTest.java +++ b/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/propertiesAudited/joined/JoinedPropertiesAuditedTest.java @@ -9,10 +9,9 @@ import org.hibernate.envers.test.integration.interfaces.hbm.propertiesAudited.Ab import org.testng.annotations.Test; /** - * @author Hernán Chanfreau + * @author Hern�n Chanfreau * */ - public class JoinedPropertiesAuditedTest extends AbstractPropertiesAuditedTest { public void configure(Ejb3Configuration cfg) { diff --git a/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/propertiesAudited/subclass/SubclassPropertiesAuditedTest.java b/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/propertiesAudited/subclass/SubclassPropertiesAuditedTest.java index 71a86d5041..96d9860f36 100644 --- a/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/propertiesAudited/subclass/SubclassPropertiesAuditedTest.java +++ b/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/propertiesAudited/subclass/SubclassPropertiesAuditedTest.java @@ -9,10 +9,9 @@ import org.hibernate.envers.test.integration.interfaces.hbm.propertiesAudited.Ab import org.testng.annotations.Test; /** - * @author Hernán Chanfreau + * @author Hern�n Chanfreau * */ - public class SubclassPropertiesAuditedTest extends AbstractPropertiesAuditedTest { public void configure(Ejb3Configuration cfg) { @@ -24,7 +23,6 @@ public class SubclassPropertiesAuditedTest extends AbstractPropertiesAuditedTest } } - @Test public void testRetrieveAudited() { super.testRetrieveAudited(); diff --git a/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/propertiesAudited/union/UnionPropertiesAuditedTest.java b/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/propertiesAudited/union/UnionPropertiesAuditedTest.java index e27a3e645f..2103c7cd52 100644 --- a/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/propertiesAudited/union/UnionPropertiesAuditedTest.java +++ b/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/propertiesAudited/union/UnionPropertiesAuditedTest.java @@ -9,10 +9,9 @@ import org.hibernate.envers.test.integration.interfaces.hbm.propertiesAudited.Ab import org.testng.annotations.Test; /** - * @author Hernán Chanfreau + * @author Hern�n Chanfreau * */ - public class UnionPropertiesAuditedTest extends AbstractPropertiesAuditedTest { public void configure(Ejb3Configuration cfg) { diff --git a/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/propertiesAudited2/AbstractPropertiesAudited2Test.java b/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/propertiesAudited2/AbstractPropertiesAudited2Test.java index 3214a82a16..a161e2f012 100644 --- a/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/propertiesAudited2/AbstractPropertiesAudited2Test.java +++ b/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/propertiesAudited2/AbstractPropertiesAudited2Test.java @@ -8,12 +8,10 @@ import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; /** - * @author Hernán Chanfreau + * @author Hern�n Chanfreau * */ - public abstract class AbstractPropertiesAudited2Test extends AbstractEntityTest { - private long ai_id; private long nai_id; @@ -60,7 +58,7 @@ public abstract class AbstractPropertiesAudited2Test extends AbstractEntityTest ai_id); assert si != null; - // levanto las de la revisión 1, ninguna debe ser null + // levanto las de la revisi�n 1, ninguna debe ser null AuditedImplementor ai_rev1 = getAuditReader().find( AuditedImplementor.class, ai_id, 1); assert ai_rev1 != null; @@ -71,10 +69,10 @@ public abstract class AbstractPropertiesAudited2Test extends AbstractEntityTest // data de las actuales no debe ser null assert ai.getData() != null; assert si.getData() != null; - // data de las revisiones está auditada + // data de las revisiones est� auditada assert ai_rev1.getData() != null; assert si_rev1.getData() != null; - // numerito de las revisiones está auditada, debe ser igual a NUMERITO + // numerito de las revisiones est� auditada, debe ser igual a NUMERITO assert ai_rev1.getNumerito() == NUMERITO; assert si_rev1.getNumerito() == NUMERITO; } diff --git a/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/propertiesAudited2/AuditedImplementor.java b/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/propertiesAudited2/AuditedImplementor.java index a10c6df8c1..7903bf62d4 100644 --- a/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/propertiesAudited2/AuditedImplementor.java +++ b/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/propertiesAudited2/AuditedImplementor.java @@ -3,24 +3,17 @@ package org.hibernate.envers.test.integration.interfaces.hbm.propertiesAudited2; import org.hibernate.envers.Audited; /** - * @author Hernán Chanfreau + * @author Hern�n Chanfreau * */ - @Audited public class AuditedImplementor implements SimpleInterface { - private long id; - private String data; - private String auditedImplementorData; - private int numerito; - protected AuditedImplementor() { - } public long getId() { diff --git a/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/propertiesAudited2/NonAuditedImplementor.java b/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/propertiesAudited2/NonAuditedImplementor.java index 1de4fa8a12..f91556ee94 100644 --- a/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/propertiesAudited2/NonAuditedImplementor.java +++ b/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/propertiesAudited2/NonAuditedImplementor.java @@ -1,23 +1,16 @@ package org.hibernate.envers.test.integration.interfaces.hbm.propertiesAudited2; /** - * @author Hernán Chanfreau + * @author Hern�n Chanfreau * */ - public class NonAuditedImplementor implements SimpleInterface { - private long id; - private String data; - private String nonAuditedImplementorData; - private int numerito; - protected NonAuditedImplementor() { - } public long getId() { diff --git a/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/propertiesAudited2/SimpleInterface.java b/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/propertiesAudited2/SimpleInterface.java index 0cc6e5a946..205764e07a 100644 --- a/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/propertiesAudited2/SimpleInterface.java +++ b/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/propertiesAudited2/SimpleInterface.java @@ -3,10 +3,9 @@ package org.hibernate.envers.test.integration.interfaces.hbm.propertiesAudited2; import org.hibernate.envers.Audited; /** - * @author Hernán Chanfreau + * @author Hern�n Chanfreau * */ - public interface SimpleInterface { long getId(); diff --git a/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/propertiesAudited2/joined/JoinedPropertiesAudited2Test.java b/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/propertiesAudited2/joined/JoinedPropertiesAudited2Test.java index 47e0aa3b60..5407655645 100644 --- a/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/propertiesAudited2/joined/JoinedPropertiesAudited2Test.java +++ b/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/propertiesAudited2/joined/JoinedPropertiesAudited2Test.java @@ -9,10 +9,8 @@ import org.hibernate.envers.test.integration.interfaces.hbm.propertiesAudited2.A import org.testng.annotations.Test; /** - * @author Hernán Chanfreau - * + * @author Hern�n Chanfreau */ - public class JoinedPropertiesAudited2Test extends AbstractPropertiesAudited2Test { public void configure(Ejb3Configuration cfg) { diff --git a/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/propertiesAudited2/subclass/SubclassPropertiesAudited2Test.java b/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/propertiesAudited2/subclass/SubclassPropertiesAudited2Test.java index 92d79e4261..05ec3ab13a 100644 --- a/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/propertiesAudited2/subclass/SubclassPropertiesAudited2Test.java +++ b/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/propertiesAudited2/subclass/SubclassPropertiesAudited2Test.java @@ -9,10 +9,9 @@ import org.hibernate.envers.test.integration.interfaces.hbm.propertiesAudited2.A import org.testng.annotations.Test; /** - * @author Hernán Chanfreau + * @author Hern�n Chanfreau * */ - public class SubclassPropertiesAudited2Test extends AbstractPropertiesAudited2Test { public void configure(Ejb3Configuration cfg) { diff --git a/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/propertiesAudited2/union/UnionPropertiesAudited2Test.java b/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/propertiesAudited2/union/UnionPropertiesAudited2Test.java index 6b347992fa..9b27362a2f 100644 --- a/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/propertiesAudited2/union/UnionPropertiesAudited2Test.java +++ b/envers/src/test/java/org/hibernate/envers/test/integration/interfaces/hbm/propertiesAudited2/union/UnionPropertiesAudited2Test.java @@ -9,10 +9,9 @@ import org.hibernate.envers.test.integration.interfaces.hbm.propertiesAudited2.A import org.testng.annotations.Test; /** - * @author Hernán Chanfreau + * @author Hern�n Chanfreau * */ - public class UnionPropertiesAudited2Test extends AbstractPropertiesAudited2Test { public void configure(Ejb3Configuration cfg) {