From 027840018b26c9c16b9245676e3d2905da34e2eb Mon Sep 17 00:00:00 2001 From: Dave Repshas Date: Thu, 18 Apr 2013 17:32:09 -0700 Subject: [PATCH] HHH-8191 Support Teradata 14.0 --- .../java/org/hibernate/cfg/Configuration.java | 26 +- .../java/org/hibernate/dialect/Dialect.java | 52 ++-- .../hibernate/dialect/Teradata14Dialect.java | 231 ++++++++++++++++++ .../hibernate/dialect/TeradataDialect.java | 64 +++-- .../main/java/org/hibernate/sql/Select.java | 5 +- .../java/org/hibernate/sql/SimpleSelect.java | 5 +- .../org/hibernate/test/annotations/Sky.java | 6 +- .../test/annotations/any/CharProperty.java | 2 +- .../test/annotations/any/IntegerProperty.java | 2 +- .../test/annotations/any/LongProperty.java | 2 +- .../test/annotations/any/StringProperty.java | 2 +- .../annotations/collectionelement/Bug.java | 2 + .../collectionelement/OrderByTest.java | 7 + .../test/annotations/embedded/CorpType.java | 2 +- .../entity/BasicHibernateAnnotationsTest.java | 3 + .../idmanytoone/CourseStudent.java | 2 + .../idmanytoone/StoreCustomer.java | 2 +- .../indexcoll/IndexedCollectionTest.java | 35 ++- .../inheritance/joined/Account.java | 2 +- .../ManyToOneWithFormulaTest.java | 5 +- .../intermediate/Account.java | 2 +- .../test/annotations/query/Area.java | 2 +- .../test/annotations/query/Dictionary.java | 2 +- .../annotations/query/QueryAndSQLTest.java | 1 + .../referencedcolumnname/Clothes.java | 2 + .../referencedcolumnname/Luggage.java | 2 + .../ReferencedColumnNameTest.java | 14 +- .../hibernate/test/annotations/type/Dvd.java | 1 + .../uniqueconstraint/Building.java | 2 +- .../annotations/uniqueconstraint/House.java | 6 +- .../annotations/uniqueconstraint/Room.java | 3 +- .../UniqueConstraintTest.java | 3 +- .../test/annotations/various/Vehicule.java | 1 + .../test/annotations/xml/ejb3/CarModel.java | 2 + .../annotations/xml/ejb3/Ejb3XmlTest.java | 9 +- .../test/event/collection/detached/Alias.java | 4 + .../test/extralazy/UserGroup.hbm.xml | 6 +- .../java/org/hibernate/test/flush/Book.java | 2 + .../test/hql/ASTParserLoadingTest.java | 55 ++--- .../org/hibernate/test/hql/Animal.hbm.xml | 2 +- .../test/hql/FunctionNamesAsColumns.hbm.xml | 4 +- .../java/org/hibernate/test/hql/HQLTest.java | 8 +- .../hqlfetchscroll/HQLScrollFetchTest.java | 46 ++-- .../idgen/identity/joinedSubClass/Super.java | 2 +- .../test/instrument/domain/Documents.hbm.xml | 2 +- .../test/jpa/ql/DestinationEntity.java | 2 +- .../hibernate/test/legacy/CustomSQL.hbm.xml | 6 +- .../org/hibernate/test/legacy/FooBarTest.java | 5 +- .../test/legacy/ParentChildTest.java | 8 +- .../test/legacy/SQLFunctionsTest.java | 3 +- .../hibernate/test/lob/BlobLocatorTest.java | 7 + .../hibernate/test/lob/ClobLocatorTest.java | 7 + .../java/org/hibernate/test/locking/A.java | 2 + .../hibernate/test/locking/LockModeTest.java | 6 +- .../org/hibernate/test/map/UserGroup.hbm.xml | 4 +- .../test/onetoone/formula/Person.hbm.xml | 2 +- .../test/querycache/Enrolment.hbm.xml | 2 +- .../test/subclassfilter/Employee.java | 2 + .../UnionSubclassFilterTest.java | 7 + .../subclassfilter/discrim-subclass.hbm.xml | 2 +- .../subclassfilter/joined-subclass.hbm.xml | 2 +- .../unionsubclass2/UnionSubclassTest.java | 17 ++ 62 files changed, 535 insertions(+), 189 deletions(-) create mode 100644 hibernate-core/src/main/java/org/hibernate/dialect/Teradata14Dialect.java diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/Configuration.java b/hibernate-core/src/main/java/org/hibernate/cfg/Configuration.java index 0e7f48d3bc..25921052a5 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/Configuration.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/Configuration.java @@ -23,19 +23,6 @@ */ package org.hibernate.cfg; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.InputStream; -import java.net.URL; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import javax.persistence.AttributeConverter; -import javax.persistence.SharedCacheMode; - import org.hibernate.EmptyInterceptor; import org.hibernate.HibernateException; import org.hibernate.Interceptor; @@ -77,6 +64,19 @@ import org.hibernate.type.SerializationException; import org.hibernate.usertype.CompositeUserType; import org.hibernate.usertype.UserType; +import javax.persistence.AttributeConverter; +import javax.persistence.SharedCacheMode; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.InputStream; +import java.net.URL; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Properties; + /** * Represents one approach for bootstrapping Hibernate. In fact, historically this was * the way to bootstrap Hibernate. diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/Dialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/Dialect.java index 14bdb649f7..b93f2f2f42 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/Dialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/Dialect.java @@ -23,23 +23,6 @@ */ package org.hibernate.dialect; -import java.io.InputStream; -import java.io.OutputStream; -import java.sql.Blob; -import java.sql.CallableStatement; -import java.sql.Clob; -import java.sql.NClob; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Types; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.Set; - import org.hibernate.HibernateException; import org.hibernate.LockMode; import org.hibernate.LockOptions; @@ -69,7 +52,6 @@ import org.hibernate.dialect.unique.UniqueDelegate; import org.hibernate.engine.jdbc.LobCreator; import org.hibernate.engine.jdbc.env.internal.DefaultSchemaNameResolver; import org.hibernate.engine.jdbc.env.spi.SchemaNameResolver; -import org.hibernate.engine.spi.RowSelection; import org.hibernate.engine.spi.SessionImplementor; import org.hibernate.exception.spi.ConversionContext; import org.hibernate.exception.spi.SQLExceptionConversionDelegate; @@ -111,9 +93,25 @@ import org.hibernate.tool.schema.spi.Exporter; import org.hibernate.type.StandardBasicTypes; import org.hibernate.type.descriptor.sql.ClobTypeDescriptor; import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; - import org.jboss.logging.Logger; +import java.io.InputStream; +import java.io.OutputStream; +import java.sql.Blob; +import java.sql.CallableStatement; +import java.sql.Clob; +import java.sql.NClob; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Types; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.Set; + /** * Represents a dialect of SQL implemented by a particular RDBMS. Subclasses implement Hibernate compatibility * with different systems. Subclasses should provide a public default constructor that register a set of type @@ -2658,10 +2656,10 @@ public abstract class Dialect implements ConversionContext { // oddly most database in fact seem to, so true is the default. return true; } - + /** * If {@link #supportsTupleDistinctCounts()} is true, does the Dialect require the tuple to be wrapped with parens? - * + * * @return boolean */ public boolean requiresParensForTupleDistinctCounts() { @@ -2769,11 +2767,11 @@ public abstract class Dialect implements ConversionContext { public boolean supportsNotNullUnique() { return true; } - + /** * Apply a hint to the query. The entire query is provided, allowing the Dialect full control over the placement * and syntax of the hint. By default, ignore the hint and simply return the query. - * + * * @param query The query to which to apply the hint. * @param hints The hints to apply * @return The modified SQL @@ -2781,20 +2779,20 @@ public abstract class Dialect implements ConversionContext { public String getQueryHintString(String query, List hints) { return query; } - + /** * Certain dialects support a subset of ScrollModes. Provide a default to be used by Criteria and Query. - * + * * @return ScrollMode */ public ScrollMode defaultScrollMode() { return ScrollMode.SCROLL_INSENSITIVE; } - + /** * Does this dialect support tuples in subqueries? Ex: * delete from Table1 where (col1, col2) in (select col1, col2 from Table2) - * + * * @return boolean */ public boolean supportsTuplesInSubqueries() { diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/Teradata14Dialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/Teradata14Dialect.java new file mode 100644 index 0000000000..6f7a91dacc --- /dev/null +++ b/hibernate-core/src/main/java/org/hibernate/dialect/Teradata14Dialect.java @@ -0,0 +1,231 @@ +/* + * 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.CallableStatement; +import java.sql.ResultSet; +import java.sql.Types; + +import org.hibernate.HibernateException; +import org.hibernate.JDBCException; + +import org.hibernate.cfg.Environment; +import org.hibernate.dialect.function.SQLFunctionTemplate; +import org.hibernate.dialect.function.VarArgsSQLFunction; +import org.hibernate.exception.spi.TemplatedViolatedConstraintNameExtracter; +import org.hibernate.exception.spi.ViolatedConstraintNameExtracter; +import org.hibernate.type.StandardBasicTypes; +import java.sql.SQLException; +import org.hibernate.LockOptions; +import java.util.Map; +import org.hibernate.sql.ForUpdateFragment; +/** + * A dialect for the Teradata database + * + */ +public class Teradata14Dialect extends TeradataDialect { + /** + * Constructor + */ + public Teradata13Dialect() { + super(); + //registerColumnType data types + registerColumnType( Types.BIGINT, "BIGINT" ); + registerColumnType( Types.BINARY, "VARBYTE(100)" ); + registerColumnType( Types.LONGVARBINARY, "VARBYTE(32000)" ); + registerColumnType( Types.LONGVARCHAR, "VARCHAR(32000)" ); + + getDefaultProperties().setProperty( Environment.USE_STREAMS_FOR_BINARY, "true" ); + getDefaultProperties().setProperty( Environment.STATEMENT_BATCH_SIZE,DEFAULT_BATCH_SIZE ); + + registerFunction( "current_time", new SQLFunctionTemplate( StandardBasicTypes.TIME, "current_time" ) ); + registerFunction( "current_date", new SQLFunctionTemplate( StandardBasicTypes.DATE, "current_date" ) ); + } + + @Override + public boolean supportsIdentityColumns() { + return true; + } + + @Override + public String getAddColumnString() { + return "Add"; + } + + /** + * Get the name of the database type associated with the given + * java.sql.Types typecode. + * + * @param code java.sql.Types typecode + * @param length the length or precision of the column + * @param precision the precision of the column + * @param scale the scale of the column + * + * @return the database type name + * + * @throws HibernateException + */ + public String getTypeName(int code, int length, int precision, int scale) throws HibernateException { + /* + * We might want a special case for 19,2. This is very common for money types + * and here it is converted to 18,1 + */ + float f = precision > 0 ? ( float ) scale / ( float ) precision : 0; + int p = ( precision > 38 ? 38 : precision ); + int s = ( precision > 38 ? ( int ) ( 38.0 * f ) : ( scale > 38 ? 38 : scale ) ); + return super.getTypeName( code, length, p, s ); + } + + @Override + public boolean areStringComparisonsCaseInsensitive() { + return false; + } + + @Override + public String getIdentityColumnString() { + return "generated by default as identity not null"; + } + + @Override + public String getIdentityInsertString() { + return "null"; + } + + @Override + public String getDropTemporaryTableString() { + return "drop temporary table"; + } + + @Override + public boolean supportsExpectedLobUsagePattern() { + return true; + } + + @Override + public ViolatedConstraintNameExtracter getViolatedConstraintNameExtracter() { + return EXTRACTER; + } + + + @Override + public boolean supportsTupleDistinctCounts() { + return false; + } + + @Override + public boolean supportsExistsInSelect() { + return false; + } + + + @Override + public boolean supportsUnboundedLobLocatorMaterialization() { + return false; + } + + + @Override + public int registerResultSetOutParameter(CallableStatement statement, int col) throws SQLException { + statement.registerOutParameter(col, Types.REF); + col++; + return col; + } + + @Override + public ResultSet getResultSet(CallableStatement cs) throws SQLException { + boolean isResultSet = cs.execute(); + while (!isResultSet && cs.getUpdateCount() != -1) { + isResultSet = cs.getMoreResults(); + } + return cs.getResultSet(); + } + + 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. + */ + @Override + public String extractConstraintName(SQLException sqle) { + String constraintName = null; + + int errorCode = sqle.getErrorCode(); + if (errorCode == 27003) { + constraintName = extractUsingTemplate("Unique constraint (", ") violated.", sqle.getMessage()); + } else if (errorCode == 2700) { + constraintName = extractUsingTemplate("Referential constraint", "violation:", sqle.getMessage()); + } else if (errorCode == 5317) { + constraintName = extractUsingTemplate("Check constraint (", ") violated.", sqle.getMessage()); + } + + if (constraintName != null) { + int i = constraintName.indexOf('.'); + if (i != -1) { + constraintName = constraintName.substring(i + 1); + } + } + return constraintName; + } + }; + + @Override + public String getWriteLockString(int timeout) { + String sMsg = " Locking row for write "; + if ( timeout == LockOptions.NO_WAIT ) { + return sMsg + " nowait "; + } + return sMsg; + } + + @Override + public String getReadLockString(int timeout) { + String sMsg = " Locking row for read "; + if ( timeout == LockOptions.NO_WAIT ) { + return sMsg + " nowait "; + } + return sMsg; + } + + @Override + public String applyLocksToSql(String sql, LockOptions aliasedLockOptions, Map keyColumnNames) { + return new ForUpdateFragment( this, aliasedLockOptions, keyColumnNames ).toFragmentString() + " " + sql; + } + + @Override + public boolean useFollowOnLocking() { + return true; + } + + @Override + public boolean isLockAppended() { + return false; + } + + @Override + public boolean supportsLockTimeouts() { + return false; + } +} + diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/TeradataDialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/TeradataDialect.java index 5c01957402..942057aa64 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/TeradataDialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/TeradataDialect.java @@ -37,6 +37,7 @@ import org.hibernate.type.StandardBasicTypes; * @author Jay Nance */ public class TeradataDialect extends Dialect { + private static final int PARAM_LIST_SIZE_LIMIT = 1024; /** @@ -62,8 +63,7 @@ public class TeradataDialect extends Dialect { registerColumnType( Types.DATE, "DATE" ); registerColumnType( Types.TIME, "TIME" ); registerColumnType( Types.TIMESTAMP, "TIMESTAMP" ); - // hibernate seems to ignore this type... - registerColumnType( Types.BOOLEAN, "BYTEINT" ); + registerColumnType( Types.BOOLEAN, "BYTEINT" ); // hibernate seems to ignore this type... registerColumnType( Types.BLOB, "BLOB" ); registerColumnType( Types.CLOB, "CLOB" ); @@ -113,87 +113,87 @@ public class TeradataDialect extends Dialect { } /** - * Teradata does not support FOR UPDATE syntax - *

- * {@inheritDoc} + * Does this dialect support the FOR UPDATE syntax? + * + * @return empty string ... Teradata does not support FOR UPDATE syntax */ - @Override public String getForUpdateString() { return ""; } - @Override public boolean supportsIdentityColumns() { return false; } - @Override public boolean supportsSequences() { return false; } - @Override public String getAddColumnString() { return "Add Column"; } - @Override public boolean supportsTemporaryTables() { return true; } - @Override public String getCreateTemporaryTableString() { return "create global temporary table"; } - @Override public String getCreateTemporaryTablePostfix() { return " on commit preserve rows"; } - @Override public Boolean performTemporaryTableDDLInIsolation() { return Boolean.TRUE; } - @Override public boolean dropTemporaryTableAfterUse() { return false; } - @Override - public String getTypeName(int code, long length, int precision, int scale) throws HibernateException { - // We might want a special case for 19,2. This is very common for money types - // and here it is converted to 18,1 - final float f = precision > 0 ? (float) scale / (float) precision : 0; - final int p = ( precision > 18 ? 18 : precision ); - final int s = ( precision > 18 ? (int) ( 18.0 * f ) : ( scale > 18 ? 18 : scale ) ); + /** + * Get the name of the database type associated with the given + * java.sql.Types typecode. + * + * @param code java.sql.Types typecode + * @param length the length or precision of the column + * @param precision the precision of the column + * @param scale the scale of the column + * + * @return the database type name + * + * @throws HibernateException + */ + public String getTypeName(int code, int length, int precision, int scale) throws HibernateException { + /* + * We might want a special case for 19,2. This is very common for money types + * and here it is converted to 18,1 + */ + float f = precision > 0 ? ( float ) scale / ( float ) precision : 0; + int p = ( precision > 18 ? 18 : precision ); + int s = ( precision > 18 ? ( int ) ( 18.0 * f ) : ( scale > 18 ? 18 : scale ) ); return super.getTypeName( code, length, p, s ); } - @Override public boolean supportsCascadeDelete() { return false; } - @Override public boolean supportsCircularCascadeDeleteConstraints() { return false; } - @Override public boolean areStringComparisonsCaseInsensitive() { return true; } - @Override public boolean supportsEmptyInList() { return false; } - @Override public String getSelectClauseNullString(int sqlType) { String v = "null"; @@ -235,39 +235,35 @@ public class TeradataDialect extends Dialect { case Types.DATALINK: case Types.BOOLEAN: break; - default: - break; } return v; } - @Override public String getCreateMultisetTableString() { return "create multiset table "; } - @Override public boolean supportsLobValueChangePropogation() { return false; } - @Override public boolean doesReadCommittedCauseWritersToBlockReaders() { return true; } - @Override public boolean doesRepeatableReadCauseReadersToBlockWriters() { return true; } - @Override public boolean supportsBindAsCallableArgument() { return false; } + /* (non-Javadoc) + * @see org.hibernate.dialect.Dialect#getInExpressionCountLimit() + */ @Override public int getInExpressionCountLimit() { return PARAM_LIST_SIZE_LIMIT; } -} +} \ No newline at end of file diff --git a/hibernate-core/src/main/java/org/hibernate/sql/Select.java b/hibernate-core/src/main/java/org/hibernate/sql/Select.java index 2b67c9b471..fad2daa509 100644 --- a/hibernate-core/src/main/java/org/hibernate/sql/Select.java +++ b/hibernate-core/src/main/java/org/hibernate/sql/Select.java @@ -92,7 +92,10 @@ public class Select { } if (lockOptions.getLockMode()!=LockMode.NONE) { - buf.append( dialect.getForUpdateString(lockOptions) ); + if (dialect.isLockAppended()) + buf.append( dialect.getForUpdateString(lockOptions) ); + else + buf.insert(0,dialect.getForUpdateString(lockOptions)); } return dialect.transformSelectString( buf.toString() ); diff --git a/hibernate-core/src/main/java/org/hibernate/sql/SimpleSelect.java b/hibernate-core/src/main/java/org/hibernate/sql/SimpleSelect.java index d8d49aa73b..62f1b19b24 100644 --- a/hibernate-core/src/main/java/org/hibernate/sql/SimpleSelect.java +++ b/hibernate-core/src/main/java/org/hibernate/sql/SimpleSelect.java @@ -187,7 +187,10 @@ public class SimpleSelect { if (orderBy!=null) buf.append(orderBy); if (lockOptions!=null) { - buf.append( dialect.getForUpdateString(lockOptions) ); + if (dialect.isLockAppended()) + buf.append( dialect.getForUpdateString(lockOptions) ); + else + buf.insert(0,dialect.getForUpdateString(lockOptions)); } return dialect.transformSelectString( buf.toString() ); diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/Sky.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/Sky.java index 4bb6175598..d9f5be26ed 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/Sky.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/Sky.java @@ -13,16 +13,16 @@ import javax.persistence.UniqueConstraint; */ @Entity @Table(name = "tbl_sky", - uniqueConstraints = {@UniqueConstraint(columnNames = {"month", "day"})} + uniqueConstraints = {@UniqueConstraint(columnNames = {"`month`", "`day`"})} ) public class Sky implements Serializable { @Id protected Long id; @Column(unique = true, columnDefinition = "varchar(250)", nullable = false) protected String color; - @Column(nullable = false) + @Column(name="`day`",nullable = false) protected String day; - @Column(name = "MONTH", nullable = false) + @Column(name = "`MONTH`", nullable = false) protected String month; @Transient protected String area; diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/any/CharProperty.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/any/CharProperty.java index 1029bf46a9..5c0a4452cf 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/any/CharProperty.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/any/CharProperty.java @@ -12,7 +12,6 @@ public class CharProperty implements Property { private String name; - @Column(name = "`value`") private Character value; public CharProperty() { @@ -43,6 +42,7 @@ public class CharProperty implements Property { this.id = id; } + @Column(name = "`value`") public Character getValue() { return value; } diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/any/IntegerProperty.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/any/IntegerProperty.java index a05794743a..e89893c7b2 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/any/IntegerProperty.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/any/IntegerProperty.java @@ -10,7 +10,6 @@ import javax.persistence.Column; public class IntegerProperty implements Property { private Integer id; private String name; - @Column(name = "`value`") private Integer value; public IntegerProperty() { @@ -41,6 +40,7 @@ public class IntegerProperty implements Property { this.id = id; } + @Column(name = "`value`") public Integer getValue() { return value; } diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/any/LongProperty.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/any/LongProperty.java index 76001abdde..8268d04a98 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/any/LongProperty.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/any/LongProperty.java @@ -11,7 +11,6 @@ public class LongProperty implements Property { private Integer id; private String name; - @Column(name = "`value`") private Long value; public LongProperty() { @@ -42,6 +41,7 @@ public class LongProperty implements Property { this.id = id; } + @Column(name = "`value`") public Long getValue() { return value; } diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/any/StringProperty.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/any/StringProperty.java index ca9dd0b43a..283a166cf5 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/any/StringProperty.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/any/StringProperty.java @@ -10,7 +10,6 @@ import javax.persistence.Column; public class StringProperty implements Property { private Integer id; private String name; - @Column(name = "`value`") private String value; public StringProperty() { @@ -41,6 +40,7 @@ public class StringProperty implements Property { return value; } + @Column(name = "`value`") public String getValue() { return value; } diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/collectionelement/Bug.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/collectionelement/Bug.java index 4eb06b5d24..3a8ca6ab85 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/collectionelement/Bug.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/collectionelement/Bug.java @@ -1,4 +1,5 @@ package org.hibernate.test.annotations.collectionelement; +import javax.persistence.Column; import javax.persistence.Embeddable; @Embeddable @@ -8,6 +9,7 @@ public class Bug { private Person reportedBy; private String summary; + @Column(name="`summary`") public String getSummary() { return summary; } diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/collectionelement/OrderByTest.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/collectionelement/OrderByTest.java index 9ae1d29f6c..8cb940496d 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/collectionelement/OrderByTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/collectionelement/OrderByTest.java @@ -27,6 +27,8 @@ import java.util.HashSet; import java.util.Iterator; import junit.framework.Assert; +import org.hibernate.dialect.TeradataDialect; +import org.hibernate.testing.SkipForDialect; import org.junit.Test; import org.hibernate.Session; @@ -74,6 +76,11 @@ public class OrderByTest extends BaseCoreFunctionalTestCase { } @Test + @SkipForDialect( + value = TeradataDialect.class, + jiraKey = "HHH-8190", + comment = "uses Teradata reserved word - summary" + ) public void testOrderByWithDottedNotation() throws Exception { Session s = openSession(); Transaction tx = s.beginTransaction(); diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/embedded/CorpType.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/embedded/CorpType.java index a42ab32ab7..4c4c854a36 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/embedded/CorpType.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/embedded/CorpType.java @@ -11,7 +11,6 @@ import javax.persistence.Column; @Entity public class CorpType { private Integer id; - @Column(name = "`type`") private String type; @Id @@ -24,6 +23,7 @@ public class CorpType { this.id = id; } + @Column(name = "`type`") public String getType() { return type; } diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/entity/BasicHibernateAnnotationsTest.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/entity/BasicHibernateAnnotationsTest.java index f7c7e2dbb2..8fbbafc922 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/entity/BasicHibernateAnnotationsTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/entity/BasicHibernateAnnotationsTest.java @@ -36,6 +36,8 @@ import java.util.Date; import java.util.HashSet; import java.util.Iterator; import java.util.Set; +import org.hibernate.dialect.TeradataDialect; +import org.hibernate.testing.SkipForDialect; import org.hibernate.AnnotationException; import org.hibernate.Hibernate; @@ -99,6 +101,7 @@ public class BasicHibernateAnnotationsTest extends BaseCoreFunctionalTestCase { @Test @RequiresDialectFeature( DialectChecks.SupportsExpectedLobUsagePattern.class ) + @SkipForDialect(value = TeradataDialect.class , comment = "One transaction hangs the other") public void testVersioning() throws Exception { Forest forest = new Forest(); forest.setName( "Fontainebleau" ); diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/idmanytoone/CourseStudent.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/idmanytoone/CourseStudent.java index 4d34f8d9df..896f14576c 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/idmanytoone/CourseStudent.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/idmanytoone/CourseStudent.java @@ -1,6 +1,7 @@ package org.hibernate.test.annotations.idmanytoone; import java.io.Serializable; +import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.Id; @@ -26,6 +27,7 @@ public class CourseStudent implements Serializable { @JoinColumn(name = "student_id") private Student student; + @Column(name = "`value`") private String value; public CourseStudent() { diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/idmanytoone/StoreCustomer.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/idmanytoone/StoreCustomer.java index b1e486c46c..4771eef898 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/idmanytoone/StoreCustomer.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/idmanytoone/StoreCustomer.java @@ -12,7 +12,7 @@ import javax.persistence.Table; * @author Emmanuel Bernard */ @Entity -@Table(name = "ABs") +@Table(name = "`ABs`") @IdClass( StoreCustomerPK.class) public class StoreCustomer implements Serializable { StoreCustomer() {} diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/indexcoll/IndexedCollectionTest.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/indexcoll/IndexedCollectionTest.java index b86d4f9ae7..626e9a4e85 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/indexcoll/IndexedCollectionTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/indexcoll/IndexedCollectionTest.java @@ -23,6 +23,19 @@ */ package org.hibernate.test.annotations.indexcoll; +import org.hibernate.Hibernate; +import org.hibernate.Session; +import org.hibernate.Transaction; +import org.hibernate.dialect.H2Dialect; +import org.hibernate.dialect.HSQLDialect; +import org.hibernate.dialect.TeradataDialect; +import org.hibernate.mapping.Collection; +import org.hibernate.mapping.Column; +import org.hibernate.testing.RequiresDialect; +import org.hibernate.testing.SkipForDialect; +import org.hibernate.testing.junit4.BaseNonConfigCoreFunctionalTestCase; +import org.junit.Test; + import java.util.ArrayList; import java.util.Date; import java.util.HashMap; @@ -30,18 +43,6 @@ import java.util.Iterator; import java.util.List; import java.util.Map; -import org.hibernate.Hibernate; -import org.hibernate.Session; -import org.hibernate.Transaction; -import org.hibernate.dialect.H2Dialect; -import org.hibernate.dialect.HSQLDialect; -import org.hibernate.mapping.Collection; -import org.hibernate.mapping.Column; - -import org.hibernate.testing.RequiresDialect; -import org.hibernate.testing.junit4.BaseNonConfigCoreFunctionalTestCase; -import org.junit.Test; - import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; @@ -375,6 +376,11 @@ public class IndexedCollectionTest extends BaseNonConfigCoreFunctionalTestCase { } @Test + @SkipForDialect( + value = TeradataDialect.class, + jiraKey = "HHH-8190", + comment = "uses Teradata reserved word - title" + ) public void testMapKeyOnManyToMany() throws Exception { Session s; s = openSession(); @@ -404,6 +410,11 @@ public class IndexedCollectionTest extends BaseNonConfigCoreFunctionalTestCase { } @Test + @SkipForDialect( + value = TeradataDialect.class, + jiraKey = "HHH-8190", + comment = "uses Teradata reserved word - title" + ) public void testMapKeyOnManyToManyOnId() throws Exception { Session s; s = openSession(); diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/inheritance/joined/Account.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/inheritance/joined/Account.java index 45d4db5258..8d200360bf 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/inheritance/joined/Account.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/inheritance/joined/Account.java @@ -37,7 +37,7 @@ import javax.persistence.OneToMany; import javax.persistence.Table; @Entity -@Table(name = "ACCOUNT") +@Table(name = "`ACCOUNT`") public class Account implements Serializable { private static final long serialVersionUID = 1L; diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/manytoonewithformula/ManyToOneWithFormulaTest.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/manytoonewithformula/ManyToOneWithFormulaTest.java index d18378fe55..34a37b8a25 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/manytoonewithformula/ManyToOneWithFormulaTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/manytoonewithformula/ManyToOneWithFormulaTest.java @@ -35,6 +35,7 @@ import org.hibernate.dialect.DB2Dialect; import org.hibernate.dialect.HSQLDialect; import org.hibernate.dialect.Oracle8iDialect; import org.hibernate.dialect.SQLServer2005Dialect; +import org.hibernate.dialect.TeradataDialect; import org.hibernate.testing.RequiresDialect; import org.hibernate.testing.SkipForDialect; import org.hibernate.testing.SkipForDialects; @@ -159,7 +160,9 @@ public class ManyToOneWithFormulaTest extends BaseCoreFunctionalTestCase { @SkipForDialect( value = { HSQLDialect.class }, comment = "The used join conditions does not work in HSQLDB. See HHH-4497." ), @SkipForDialect( value = { SQLServer2005Dialect.class } ), @SkipForDialect( value = { Oracle8iDialect.class }, comment = "Oracle/DB2 do not support 'substring' function" ), - @SkipForDialect( value = { DB2Dialect.class }, comment = "Oracle/DB2 do not support 'substring' function" ) } ) + @SkipForDialect( value = { DB2Dialect.class }, comment = "Oracle/DB2 do not support 'substring' function" ), + @SkipForDialect( value = {TeradataDialect.class }, comment = "Teradata doesn't support substring(?,?,?). \"substr\" would work." ), + } ) public void testManyToOneFromNonPkToNonPk() throws Exception { // also tests usage of the stand-alone @JoinFormula annotation (i.e. not wrapped within @JoinColumnsOrFormulas) Session s = openSession(); diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/mappedsuperclass/intermediate/Account.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/mappedsuperclass/intermediate/Account.java index 821ed37e2c..194d0fb8af 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/mappedsuperclass/intermediate/Account.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/mappedsuperclass/intermediate/Account.java @@ -33,7 +33,7 @@ import javax.persistence.Table; * @author Saša Obradović */ @Entity -@Table(name = "ACCOUNT") +@Table(name = "`ACCOUNT`") @Inheritance(strategy = InheritanceType.JOINED) public class Account extends AccountBase { public Account() { diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/query/Area.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/query/Area.java index 679bd66763..77072e4c4b 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/query/Area.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/query/Area.java @@ -61,7 +61,7 @@ public class Area { this.id = id; } - @Column(unique = true) + @Column(unique = true, nullable=false) public String getName() { return name; } diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/query/Dictionary.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/query/Dictionary.java index fe8a596e59..6542a5d1dc 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/query/Dictionary.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/query/Dictionary.java @@ -30,7 +30,7 @@ import javax.persistence.SqlResultSetMapping; } ) @NamedNativeQuery(name = "all.dictionaries", - query = "select id, name, editor, disc as type from Dictionary", + query = "select id, name, editor, disc as \"type\" from Dictionary", resultSetMapping = "dictionary") public class Dictionary { private Integer id; diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/query/QueryAndSQLTest.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/query/QueryAndSQLTest.java index 9a4846683f..9d64452304 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/query/QueryAndSQLTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/query/QueryAndSQLTest.java @@ -243,6 +243,7 @@ public class QueryAndSQLTest extends BaseCoreFunctionalTestCase { tx = s.beginTransaction(); Statistics stats = sessionFactory().getStatistics(); stats.setStatisticsEnabled( true ); + stats.clear(); Query q = s.getNamedQuery( "night&areaCached" ); q.setCacheable( true ); List result = q.list(); diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/referencedcolumnname/Clothes.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/referencedcolumnname/Clothes.java index c3d31ca4c2..128fa08896 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/referencedcolumnname/Clothes.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/referencedcolumnname/Clothes.java @@ -1,6 +1,7 @@ //$Id$ package org.hibernate.test.annotations.referencedcolumnname; import javax.persistence.Entity; +import javax.persistence.Column; import javax.persistence.GeneratedValue; import javax.persistence.Id; @@ -10,6 +11,7 @@ import javax.persistence.Id; @Entity public class Clothes { private Integer id; + @Column(name = "type") private String type; private String flavor; diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/referencedcolumnname/Luggage.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/referencedcolumnname/Luggage.java index 2876959098..d4980f08b7 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/referencedcolumnname/Luggage.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/referencedcolumnname/Luggage.java @@ -4,6 +4,7 @@ import java.io.Serializable; import java.util.HashSet; import java.util.Set; import javax.persistence.CascadeType; +import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; @@ -18,6 +19,7 @@ import javax.persistence.OneToMany; public class Luggage implements Serializable { private Integer id; private String owner; + @Column(name = "`type`") private String type; private Set hasInside = new HashSet(); diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/referencedcolumnname/ReferencedColumnNameTest.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/referencedcolumnname/ReferencedColumnNameTest.java index df6d0d6b5a..22cdd0b9f1 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/referencedcolumnname/ReferencedColumnNameTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/referencedcolumnname/ReferencedColumnNameTest.java @@ -23,18 +23,19 @@ */ package org.hibernate.test.annotations.referencedcolumnname; -import java.math.BigDecimal; -import java.util.Iterator; - import org.hibernate.Session; import org.hibernate.Transaction; import org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyJpaImpl; import org.hibernate.cfg.Configuration; import org.hibernate.criterion.Restrictions; - +import org.hibernate.dialect.TeradataDialect; +import org.hibernate.testing.SkipForDialect; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; import org.junit.Test; +import java.math.BigDecimal; +import java.util.Iterator; + import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; @@ -102,6 +103,11 @@ public class ReferencedColumnNameTest extends BaseCoreFunctionalTestCase { } @Test + @SkipForDialect( + value = TeradataDialect.class, + jiraKey = "HHH-8190", + comment = "uses Teradata reserved word - type" + ) public void testUnidirectionalOneToMany() throws Exception { Session s; Transaction tx; diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/type/Dvd.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/type/Dvd.java index 326c779417..a1a21c0b15 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/type/Dvd.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/type/Dvd.java @@ -37,6 +37,7 @@ public class Dvd { this.id = id; } + @Column(name="`title`") public String getTitle() { return title; } diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/uniqueconstraint/Building.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/uniqueconstraint/Building.java index a6a2a43a45..44f6d814c9 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/uniqueconstraint/Building.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/uniqueconstraint/Building.java @@ -21,7 +21,7 @@ public class Building { this.height = height; } - @ManyToOne + @ManyToOne(optional = false) public Room getRoom() { return room; } diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/uniqueconstraint/House.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/uniqueconstraint/House.java index 2d6ffaf528..de2455d6ae 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/uniqueconstraint/House.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/uniqueconstraint/House.java @@ -1,9 +1,11 @@ package org.hibernate.test.annotations.uniqueconstraint; +import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; import javax.persistence.UniqueConstraint; +import javax.validation.constraints.NotNull; /** * @author Manuel Bernhardt @@ -11,9 +13,9 @@ import javax.persistence.UniqueConstraint; @Entity @Table(uniqueConstraints = {@UniqueConstraint(name = "uniqueWithInherited", columnNames = {"room_id", "cost"} )}) public class House extends Building { - + @Column(nullable = false) public Long id; - + @NotNull public Integer cost; @Id diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/uniqueconstraint/Room.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/uniqueconstraint/Room.java index 78057ad33f..b244814fce 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/uniqueconstraint/Room.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/uniqueconstraint/Room.java @@ -1,5 +1,6 @@ package org.hibernate.test.annotations.uniqueconstraint; +import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; @@ -8,7 +9,6 @@ import javax.persistence.Id; */ @Entity public class Room { - private Long id; private String name; @@ -22,6 +22,7 @@ public class Room { } @Id + @Column(nullable = false) public Long getId() { return id; } diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/uniqueconstraint/UniqueConstraintTest.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/uniqueconstraint/UniqueConstraintTest.java index a49fe0b42f..e4531a237f 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/uniqueconstraint/UniqueConstraintTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/uniqueconstraint/UniqueConstraintTest.java @@ -3,7 +3,6 @@ package org.hibernate.test.annotations.uniqueconstraint; import org.hibernate.JDBCException; import org.hibernate.Session; import org.hibernate.Transaction; - import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; import org.junit.Test; @@ -24,7 +23,7 @@ public class UniqueConstraintTest extends BaseCoreFunctionalTestCase { } @Test - public void testUniquenessConstraintWithSuperclassProperty() throws Exception { + public void testUniquenessConstraintWithSuperclassProperty() throws Exception { Session s = openSession(); Transaction tx = s.beginTransaction(); Room livingRoom = new Room(); diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/various/Vehicule.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/various/Vehicule.java index 0dca018025..3e9c5b8128 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/various/Vehicule.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/various/Vehicule.java @@ -35,6 +35,7 @@ public class Vehicule { @Index(name = "thirdone") private Conductor currentConductor; @Index(name = "year_idx") + @Column(name = "`year`") private Integer year; @ManyToOne(optional = true) @Index(name = "forthone") diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/xml/ejb3/CarModel.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/xml/ejb3/CarModel.java index eae089e017..f0a13d42b5 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/xml/ejb3/CarModel.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/xml/ejb3/CarModel.java @@ -22,12 +22,14 @@ * Boston, MA 02110-1301 USA */ package org.hibernate.test.annotations.xml.ejb3; +import javax.persistence.Column; import java.util.Date; /** * @author Emmanuel Bernard */ public class CarModel extends Model { + @Column(name="`year`") private Date year; public Date getYear() { diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/xml/ejb3/Ejb3XmlTest.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/xml/ejb3/Ejb3XmlTest.java index 21a2308357..616259c488 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/xml/ejb3/Ejb3XmlTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/xml/ejb3/Ejb3XmlTest.java @@ -33,8 +33,10 @@ import org.hibernate.SessionFactory; import org.hibernate.Transaction; import org.hibernate.dialect.PostgreSQL81Dialect; import org.hibernate.dialect.PostgreSQLDialect; +import org.hibernate.dialect.TeradataDialect;; import org.hibernate.persister.collection.BasicCollectionPersister; import org.hibernate.testing.SkipForDialect; +import org.hibernate.testing.SkipForDialects; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; import static org.junit.Assert.assertEquals; @@ -45,8 +47,13 @@ import static org.junit.Assert.assertNotNull; */ public class Ejb3XmlTest extends BaseCoreFunctionalTestCase { @Test + @SkipForDialects ( { @SkipForDialect(value = { PostgreSQL81Dialect.class, PostgreSQLDialect.class }, - comment = "postgresql jdbc driver does not implement the setQueryTimeout method") + comment = "postgresql jdbc driver does not implement the setQueryTimeout method"), + @SkipForDialect(value = TeradataDialect.class , + jiraKey = "HHH-8190", + comment = "uses Teradata reserved word - year") +} ) public void testEjb3Xml() throws Exception { Session s = openSession(); Transaction tx = s.beginTransaction(); diff --git a/hibernate-core/src/test/java/org/hibernate/test/event/collection/detached/Alias.java b/hibernate-core/src/test/java/org/hibernate/test/event/collection/detached/Alias.java index f5b864727c..0a39beb9be 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/event/collection/detached/Alias.java +++ b/hibernate-core/src/test/java/org/hibernate/test/event/collection/detached/Alias.java @@ -24,12 +24,14 @@ package org.hibernate.test.event.collection.detached; import javax.persistence.CascadeType; +import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Index; import javax.persistence.JoinColumn; import javax.persistence.JoinTable; import javax.persistence.ManyToMany; +import javax.persistence.Table; import java.util.ArrayList; import java.util.List; @@ -37,6 +39,7 @@ import java.util.List; * @author Steve Ebersole */ @Entity +@Table(name="`Alias`") public class Alias implements Identifiable { private Integer id; private String alias; @@ -60,6 +63,7 @@ public class Alias implements Identifiable { this.id = id; } + @Column(name="`alias`") public String getAlias() { return alias; } diff --git a/hibernate-core/src/test/java/org/hibernate/test/extralazy/UserGroup.hbm.xml b/hibernate-core/src/test/java/org/hibernate/test/extralazy/UserGroup.hbm.xml index d280af2b36..5a5edc21b0 100755 --- a/hibernate-core/src/test/java/org/hibernate/test/extralazy/UserGroup.hbm.xml +++ b/hibernate-core/src/test/java/org/hibernate/test/extralazy/UserGroup.hbm.xml @@ -21,7 +21,7 @@ - + @@ -36,7 +36,7 @@ - + @@ -55,7 +55,7 @@ select - lower(u.name) as {u.name}, lower(u.password) as {u.password}, + lower(u.name) as {u.name}, lower(u."password") as {u.password}, lower(s.userName) as {s.key}, lower(s.name) as {s.index}, s.id as {s.element}, {s.element.*} from users u diff --git a/hibernate-core/src/test/java/org/hibernate/test/flush/Book.java b/hibernate-core/src/test/java/org/hibernate/test/flush/Book.java index 600723dc77..88f027405c 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/flush/Book.java +++ b/hibernate-core/src/test/java/org/hibernate/test/flush/Book.java @@ -24,6 +24,7 @@ package org.hibernate.test.flush; import javax.persistence.CascadeType; +import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; @@ -59,6 +60,7 @@ public class Book { this.id = id; } + @Column(name="`title`") public String getTitle() { return title; } diff --git a/hibernate-core/src/test/java/org/hibernate/test/hql/ASTParserLoadingTest.java b/hibernate-core/src/test/java/org/hibernate/test/hql/ASTParserLoadingTest.java index 404fa01327..975d28f2c2 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/hql/ASTParserLoadingTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/hql/ASTParserLoadingTest.java @@ -23,18 +23,6 @@ */ package org.hibernate.test.hql; -import java.math.BigDecimal; -import java.math.BigInteger; -import java.sql.Date; -import java.sql.Time; -import java.sql.Timestamp; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - import org.hibernate.Hibernate; import org.hibernate.HibernateException; import org.hibernate.Query; @@ -61,23 +49,11 @@ import org.hibernate.dialect.Sybase11Dialect; import org.hibernate.dialect.SybaseASE15Dialect; import org.hibernate.dialect.SybaseAnywhereDialect; import org.hibernate.dialect.SybaseDialect; +import org.hibernate.dialect.TeradataDialect; import org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory; import org.hibernate.internal.util.StringHelper; import org.hibernate.persister.entity.DiscriminatorType; import org.hibernate.stat.QueryStatistics; -import org.hibernate.transform.DistinctRootEntityResultTransformer; -import org.hibernate.transform.Transformers; -import org.hibernate.type.ComponentType; -import org.hibernate.type.ManyToOneType; -import org.hibernate.type.Type; - -import org.hibernate.testing.DialectChecks; -import org.hibernate.testing.FailureExpected; -import org.hibernate.testing.RequiresDialect; -import org.hibernate.testing.RequiresDialectFeature; -import org.hibernate.testing.SkipForDialect; -import org.hibernate.testing.TestForIssue; -import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; import org.hibernate.test.any.IntegerPropertyValue; import org.hibernate.test.any.PropertySet; import org.hibernate.test.any.PropertyValue; @@ -87,9 +63,32 @@ import org.hibernate.test.cid.LineItem; import org.hibernate.test.cid.LineItem.Id; import org.hibernate.test.cid.Order; import org.hibernate.test.cid.Product; +import org.hibernate.testing.DialectChecks; +import org.hibernate.testing.FailureExpected; +import org.hibernate.testing.RequiresDialect; +import org.hibernate.testing.RequiresDialectFeature; +import org.hibernate.testing.SkipForDialect; +import org.hibernate.testing.TestForIssue; +import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; +import org.hibernate.transform.DistinctRootEntityResultTransformer; +import org.hibernate.transform.Transformers; +import org.hibernate.type.ComponentType; +import org.hibernate.type.ManyToOneType; +import org.hibernate.type.Type; +import org.jboss.logging.Logger; import org.junit.Test; -import org.jboss.logging.Logger; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.sql.Date; +import java.sql.Time; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; import static org.hibernate.testing.junit4.ExtraAssertions.assertClassAssignability; import static org.junit.Assert.assertEquals; @@ -2542,7 +2541,7 @@ public class ASTParserLoadingTest extends BaseCoreFunctionalTestCase { an.setBodyWeight(123.45f); session.persist( an ); String str = (String) session.createQuery("select str(an.bodyWeight) from Animal an where str(an.bodyWeight) like '%1%'").uniqueResult(); - if ( getDialect() instanceof DB2Dialect ) { + if ( getDialect() instanceof DB2Dialect || getDialect() instanceof TeradataDialect) { assertTrue( str.startsWith("1.234") ); } else //noinspection deprecation @@ -2560,7 +2559,7 @@ public class ASTParserLoadingTest extends BaseCoreFunctionalTestCase { } //noinspection deprecation - if ( ! ( getDialect() instanceof SybaseDialect ) && ! ( getDialect() instanceof Sybase11Dialect ) && ! ( getDialect() instanceof SybaseASE15Dialect ) && ! ( getDialect() instanceof SybaseAnywhereDialect ) && ! ( getDialect() instanceof SQLServerDialect ) ) { + if ( ! ( getDialect() instanceof SybaseDialect ) && ! ( getDialect() instanceof Sybase11Dialect ) && ! ( getDialect() instanceof SybaseASE15Dialect ) && ! ( getDialect() instanceof SybaseAnywhereDialect ) && ! ( getDialect() instanceof SQLServerDialect || getDialect() instanceof TeradataDialect ) ) { // In TransactSQL (the variant spoken by Sybase and SQLServer), the str() function // is explicitly intended for numeric values only... String dateStr1 = (String) session.createQuery("select str(current_date) from Animal").uniqueResult(); diff --git a/hibernate-core/src/test/java/org/hibernate/test/hql/Animal.hbm.xml b/hibernate-core/src/test/java/org/hibernate/test/hql/Animal.hbm.xml index 2519bfc421..a680c96415 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/hql/Animal.hbm.xml +++ b/hibernate-core/src/test/java/org/hibernate/test/hql/Animal.hbm.xml @@ -114,7 +114,7 @@ - + diff --git a/hibernate-core/src/test/java/org/hibernate/test/hql/FunctionNamesAsColumns.hbm.xml b/hibernate-core/src/test/java/org/hibernate/test/hql/FunctionNamesAsColumns.hbm.xml index 85fa4019d3..12005342d1 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/hql/FunctionNamesAsColumns.hbm.xml +++ b/hibernate-core/src/test/java/org/hibernate/test/hql/FunctionNamesAsColumns.hbm.xml @@ -25,8 +25,8 @@ - - + + diff --git a/hibernate-core/src/test/java/org/hibernate/test/hql/HQLTest.java b/hibernate-core/src/test/java/org/hibernate/test/hql/HQLTest.java index 8705bc3819..78484091a1 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/hql/HQLTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/hql/HQLTest.java @@ -49,6 +49,7 @@ import org.hibernate.dialect.Sybase11Dialect; import org.hibernate.dialect.SybaseASE15Dialect; import org.hibernate.dialect.SybaseAnywhereDialect; import org.hibernate.dialect.SybaseDialect; +import org.hibernate.dialect.TeradataDialect; import org.hibernate.dialect.function.SQLFunction; import org.hibernate.engine.query.spi.HQLQueryPlan; import org.hibernate.engine.query.spi.ReturnMetadata; @@ -346,17 +347,17 @@ public class HQLTest extends QueryTranslatorTestCase { assertTranslation("from Animal a where abs(:param - a.bodyWeight) < 2.0"); assertTranslation("from Animal where abs(:x - :y) < 2.0"); assertTranslation("from Animal where lower(upper(:foo)) like 'f%'"); - if ( ! ( getDialect() instanceof SybaseDialect ) && ! ( getDialect() instanceof Sybase11Dialect ) && ! ( getDialect() instanceof SybaseASE15Dialect ) && ! ( getDialect() instanceof SQLServerDialect ) ) { + if ( ! ( getDialect() instanceof SybaseDialect ) && ! ( getDialect() instanceof Sybase11Dialect ) && ! ( getDialect() instanceof SybaseASE15Dialect ) && ! ( getDialect() instanceof SQLServerDialect ) && ! ( getDialect() instanceof TeradataDialect ) ) { // Transact-SQL dialects (except SybaseAnywhereDialect) map the length function -> len; // classic translator does not consider that *when nested*; // SybaseAnywhereDialect supports the length function assertTranslation("from Animal a where abs(abs(a.bodyWeight - 1.0 + :param) * abs(length('ffobar')-3)) = 3.0"); } - if ( !( getDialect() instanceof MySQLDialect ) && ! ( getDialect() instanceof SybaseDialect ) && ! ( getDialect() instanceof Sybase11Dialect ) && !( getDialect() instanceof SybaseASE15Dialect ) && ! ( getDialect() instanceof SybaseAnywhereDialect ) && ! ( getDialect() instanceof SQLServerDialect ) ) { + if ( !( getDialect() instanceof MySQLDialect ) && ! ( getDialect() instanceof SybaseDialect ) && ! ( getDialect() instanceof Sybase11Dialect ) && !( getDialect() instanceof SybaseASE15Dialect ) && ! ( getDialect() instanceof SybaseAnywhereDialect ) && ! ( getDialect() instanceof SQLServerDialect ) && ! ( getDialect() instanceof TeradataDialect ) ) { assertTranslation("from Animal where lower(upper('foo') || upper(:bar)) like 'f%'"); } - if ( getDialect() instanceof PostgreSQLDialect || getDialect() instanceof PostgreSQL81Dialect ) { + if ( getDialect() instanceof PostgreSQLDialect || getDialect() instanceof PostgreSQL81Dialect || getDialect() instanceof TeradataDialect) { return; } if ( getDialect() instanceof AbstractHANADialect ) { @@ -846,6 +847,7 @@ public class HQLTest extends QueryTranslatorTestCase { public void testGroupByFunction() { if ( getDialect() instanceof Oracle8iDialect ) return; // the new hiearchy... if ( getDialect() instanceof PostgreSQLDialect || getDialect() instanceof PostgreSQL81Dialect ) return; + if ( getDialect() instanceof TeradataDialect) return; if ( ! H2Dialect.class.isInstance( getDialect() ) ) { // H2 has no year function assertTranslation( "select count(*) from Human h group by year(h.birthdate)" ); diff --git a/hibernate-core/src/test/java/org/hibernate/test/hqlfetchscroll/HQLScrollFetchTest.java b/hibernate-core/src/test/java/org/hibernate/test/hqlfetchscroll/HQLScrollFetchTest.java index 872a631bf7..038d4806b8 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/hqlfetchscroll/HQLScrollFetchTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/hqlfetchscroll/HQLScrollFetchTest.java @@ -1,11 +1,21 @@ package org.hibernate.test.hqlfetchscroll; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertSame; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import org.hibernate.Hibernate; +import org.hibernate.ScrollableResults; +import org.hibernate.Session; +import org.hibernate.Transaction; +import org.hibernate.dialect.AbstractHANADialect; +import org.hibernate.dialect.DB2Dialect; +import org.hibernate.dialect.H2Dialect; +import org.hibernate.dialect.Oracle8iDialect; +import org.hibernate.dialect.SQLServerDialect; +import org.hibernate.dialect.TeradataDialect; +import org.hibernate.engine.spi.SessionImplementor; +import org.hibernate.testing.SkipForDialect; +import org.hibernate.testing.TestForIssue; +import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; +import org.hibernate.transform.DistinctRootEntityResultTransformer; +import org.junit.Test; import java.util.ArrayList; import java.util.HashSet; @@ -13,21 +23,12 @@ import java.util.Iterator; import java.util.List; import java.util.Set; -import org.hibernate.Hibernate; -import org.hibernate.ScrollableResults; -import org.hibernate.Session; -import org.hibernate.Transaction; -import org.hibernate.dialect.DB2Dialect; -import org.hibernate.dialect.H2Dialect; -import org.hibernate.dialect.AbstractHANADialect; -import org.hibernate.dialect.Oracle8iDialect; -import org.hibernate.dialect.SQLServerDialect; -import org.hibernate.engine.spi.SessionImplementor; -import org.hibernate.testing.SkipForDialect; -import org.hibernate.testing.TestForIssue; -import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; -import org.hibernate.transform.DistinctRootEntityResultTransformer; -import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertSame; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; @SkipForDialect( value = { Oracle8iDialect.class, AbstractHANADialect.class }, comment = "Oracle/HANA do not support the identity column used in the mapping. Extended by NoIdentityHQLScrollFetchTest" ) @@ -43,7 +44,8 @@ public class HQLScrollFetchTest extends BaseCoreFunctionalTestCase { } @Test - @SkipForDialect( { SQLServerDialect.class, Oracle8iDialect.class, H2Dialect.class, DB2Dialect.class, AbstractHANADialect.class } ) + @SkipForDialect( { SQLServerDialect.class, Oracle8iDialect.class, H2Dialect.class, DB2Dialect.class, + AbstractHANADialect.class, TeradataDialect.class } ) public void testScroll() { Session s = openSession(); ScrollableResults results = s.createQuery( QUERY ).scroll(); diff --git a/hibernate-core/src/test/java/org/hibernate/test/idgen/identity/joinedSubClass/Super.java b/hibernate-core/src/test/java/org/hibernate/test/idgen/identity/joinedSubClass/Super.java index 41f320e828..91d32f96f0 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/idgen/identity/joinedSubClass/Super.java +++ b/hibernate-core/src/test/java/org/hibernate/test/idgen/identity/joinedSubClass/Super.java @@ -43,6 +43,6 @@ public class Super { @GeneratedValue(strategy = IDENTITY) private Long id; - @Column + @Column(name="`value`") private Long value; } diff --git a/hibernate-core/src/test/java/org/hibernate/test/instrument/domain/Documents.hbm.xml b/hibernate-core/src/test/java/org/hibernate/test/instrument/domain/Documents.hbm.xml index 92e4b6182a..75ebf71f00 100755 --- a/hibernate-core/src/test/java/org/hibernate/test/instrument/domain/Documents.hbm.xml +++ b/hibernate-core/src/test/java/org/hibernate/test/instrument/domain/Documents.hbm.xml @@ -48,7 +48,7 @@ - + diff --git a/hibernate-core/src/test/java/org/hibernate/test/jpa/ql/DestinationEntity.java b/hibernate-core/src/test/java/org/hibernate/test/jpa/ql/DestinationEntity.java index 56963ab3f4..e90dfe16a4 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/jpa/ql/DestinationEntity.java +++ b/hibernate-core/src/test/java/org/hibernate/test/jpa/ql/DestinationEntity.java @@ -43,7 +43,7 @@ import javax.persistence.Table; @NamedNativeQuery(name = "DestinationEntity.update", query = "update destination_entity set from_id=:idFrom, fullNameFrom=:fullName" + " where id in (:ids)"), @NamedNativeQuery(name = "DestinationEntity.delete", query = "delete from destination_entity where id in (:ids)"), - @NamedNativeQuery(name = "DestinationEntity.selectIds", query = "select id, from_id, fullNameFrom from destination_entity where id in (:ids)") }) + @NamedNativeQuery(name = "DestinationEntity.selectIds", query = "select id, from_id, fullNameFrom from destination_entity where id in (:ids) order by id") }) public class DestinationEntity { @Id diff --git a/hibernate-core/src/test/java/org/hibernate/test/legacy/CustomSQL.hbm.xml b/hibernate-core/src/test/java/org/hibernate/test/legacy/CustomSQL.hbm.xml index 5cacb1fa51..93e2960a4d 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/legacy/CustomSQL.hbm.xml +++ b/hibernate-core/src/test/java/org/hibernate/test/legacy/CustomSQL.hbm.xml @@ -3,7 +3,7 @@ "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> - + @@ -36,9 +36,9 @@ {? = call updatePatient (?, ?, ?, ?)} --> - insert into Role (name, id) values (?, upper(?)) /** i did this */ + insert into "Role" (name, id) values (?, upper(?)) /** i did this */ - delete from Role where id=? + delete from "Role" where id=? diff --git a/hibernate-core/src/test/java/org/hibernate/test/legacy/FooBarTest.java b/hibernate-core/src/test/java/org/hibernate/test/legacy/FooBarTest.java index c56710181b..7b25f8b6c1 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/legacy/FooBarTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/legacy/FooBarTest.java @@ -85,6 +85,7 @@ import org.hibernate.dialect.SAPDBDialect; import org.hibernate.dialect.Sybase11Dialect; import org.hibernate.dialect.SybaseASE15Dialect; import org.hibernate.dialect.SybaseDialect; +import org.hibernate.dialect.TeradataDialect; import org.hibernate.dialect.TimesTenDialect; import org.hibernate.engine.jdbc.connections.spi.ConnectionProvider; import org.hibernate.engine.spi.SessionImplementor; @@ -593,7 +594,7 @@ public class FooBarTest extends LegacyTestCase { "select foo.foo.foo.foo from Foo foo, Foo foo2 where" + " foo = foo2.foo and not not ( not foo.string='fizard' )" + " and foo2.string between 'a' and (foo.foo.string)" - + ( ( getDialect() instanceof HSQLDialect || getDialect() instanceof InterbaseDialect || getDialect() instanceof TimesTenDialect ) ? + + ( ( getDialect() instanceof HSQLDialect || getDialect() instanceof InterbaseDialect || getDialect() instanceof TimesTenDialect || getDialect() instanceof TeradataDialect) ? " and ( foo2.string in ( 'fiz', 'blah') or 1=1 )" : " and ( foo2.string in ( 'fiz', 'blah', foo.foo.string, foo.string, foo2.string ) )" @@ -618,7 +619,7 @@ public class FooBarTest extends LegacyTestCase { s.save(bar); s.save(baz); list = s.createQuery( - " from Bar bar where bar.baz.count=667 and bar.baz.count!=123 and not bar.baz.name='1-E-1'" + " from Bar bar where bar.baz.count=667 and bar.baz.count<>123 and not bar.baz.name='1-E-1'" ).list(); assertTrue( "query many-to-one", list.size()==1 ); list = s.createQuery( " from Bar i where i.baz.name='Bazza'" ).list(); diff --git a/hibernate-core/src/test/java/org/hibernate/test/legacy/ParentChildTest.java b/hibernate-core/src/test/java/org/hibernate/test/legacy/ParentChildTest.java index 875ca2598e..29d3af3eb4 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/legacy/ParentChildTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/legacy/ParentChildTest.java @@ -34,6 +34,7 @@ import java.util.Iterator; import java.util.List; import java.util.Map; +import org.hibernate.testing.SkipForDialect; import org.junit.Test; import org.hibernate.Criteria; @@ -49,6 +50,7 @@ import org.hibernate.criterion.Restrictions; import org.hibernate.dialect.HSQLDialect; import org.hibernate.dialect.IngresDialect; import org.hibernate.dialect.MySQLDialect; +import org.hibernate.dialect.TeradataDialect; import org.hibernate.engine.spi.EntityEntry; import org.hibernate.internal.SessionImpl; import org.hibernate.jdbc.AbstractWork; @@ -1200,7 +1202,7 @@ public class ParentChildTest extends LegacyTestCase { s.close(); } - @Test + @Test public void testLoadAfterNonExists() throws HibernateException, SQLException { Session session = openSession(); if ( ( getDialect() instanceof MySQLDialect ) || ( getDialect() instanceof IngresDialect ) ) { @@ -1221,6 +1223,10 @@ public class ParentChildTest extends LegacyTestCase { fail(); } catch(ObjectNotFoundException onfe) { + if ( getDialect() instanceof TeradataDialect ){ + session.getTransaction().rollback(); + session.getTransaction().begin(); + } // this is correct } diff --git a/hibernate-core/src/test/java/org/hibernate/test/legacy/SQLFunctionsTest.java b/hibernate-core/src/test/java/org/hibernate/test/legacy/SQLFunctionsTest.java index 6956140ef3..c93c429bd4 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/legacy/SQLFunctionsTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/legacy/SQLFunctionsTest.java @@ -31,6 +31,7 @@ import java.util.Iterator; import java.util.List; import java.util.Map; +import org.hibernate.dialect.TeradataDialect; import org.jboss.logging.Logger; import org.junit.Test; @@ -550,7 +551,7 @@ public class SQLFunctionsTest extends LegacyTestCase { @Test public void testBlobClob() throws Exception { // Sybase does not support ResultSet.getBlob(String) - if ( getDialect() instanceof SybaseDialect || getDialect() instanceof Sybase11Dialect || getDialect() instanceof SybaseASE15Dialect || getDialect() instanceof SybaseAnywhereDialect ) { + if ( getDialect() instanceof SybaseDialect || getDialect() instanceof Sybase11Dialect || getDialect() instanceof SybaseASE15Dialect || getDialect() instanceof SybaseAnywhereDialect || getDialect() instanceof TeradataDialect) { return; } Session s = openSession(); diff --git a/hibernate-core/src/test/java/org/hibernate/test/lob/BlobLocatorTest.java b/hibernate-core/src/test/java/org/hibernate/test/lob/BlobLocatorTest.java index c3f2cc66f2..f00944be9f 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/lob/BlobLocatorTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/lob/BlobLocatorTest.java @@ -25,6 +25,8 @@ package org.hibernate.test.lob; import java.sql.Blob; import junit.framework.AssertionFailedError; +import org.hibernate.dialect.TeradataDialect; +import org.hibernate.testing.SkipForDialect; import org.junit.Assert; import org.junit.Test; @@ -54,6 +56,11 @@ public class BlobLocatorTest extends BaseCoreFunctionalTestCase { } @Test + @SkipForDialect( + value = TeradataDialect.class, + jiraKey = "HHH-6637", + comment = "Teradata requires locator to be used in same session where it was created/retrieved" + ) public void testBoundedBlobLocatorAccess() throws Throwable { byte[] original = buildByteArray( BLOB_SIZE, true ); byte[] changed = buildByteArray( BLOB_SIZE, false ); diff --git a/hibernate-core/src/test/java/org/hibernate/test/lob/ClobLocatorTest.java b/hibernate-core/src/test/java/org/hibernate/test/lob/ClobLocatorTest.java index 95c5add9c8..38757534ea 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/lob/ClobLocatorTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/lob/ClobLocatorTest.java @@ -25,6 +25,8 @@ package org.hibernate.test.lob; import java.sql.Clob; +import org.hibernate.dialect.TeradataDialect; +import org.hibernate.testing.SkipForDialect; import org.junit.Test; import org.hibernate.LockMode; @@ -57,6 +59,11 @@ public class ClobLocatorTest extends BaseCoreFunctionalTestCase { } @Test + @SkipForDialect( + value = TeradataDialect.class, + jiraKey = "HHH-6637", + comment = "Teradata requires locator to be used in same session where it was created/retrieved" + ) public void testBoundedClobLocatorAccess() throws Throwable { String original = buildString( CLOB_SIZE, 'x' ); String changed = buildString( CLOB_SIZE, 'y' ); diff --git a/hibernate-core/src/test/java/org/hibernate/test/locking/A.java b/hibernate-core/src/test/java/org/hibernate/test/locking/A.java index 98a36c84af..2d3e941162 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/locking/A.java +++ b/hibernate-core/src/test/java/org/hibernate/test/locking/A.java @@ -23,6 +23,7 @@ */ package org.hibernate.test.locking; +import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; @@ -57,6 +58,7 @@ public class A { this.id = id; } + @Column(name="`value`") public String getValue() { return value; } diff --git a/hibernate-core/src/test/java/org/hibernate/test/locking/LockModeTest.java b/hibernate-core/src/test/java/org/hibernate/test/locking/LockModeTest.java index 25aa8acd36..620b2b1645 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/locking/LockModeTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/locking/LockModeTest.java @@ -25,6 +25,8 @@ package org.hibernate.test.locking; import java.util.concurrent.TimeoutException; +import org.hibernate.dialect.TeradataDialect; +import org.hibernate.testing.SkipForDialects; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -51,8 +53,10 @@ import static org.junit.Assert.fail; * @author Steve Ebersole */ @TestForIssue( jiraKey = "HHH-5275") +@SkipForDialects( { @SkipForDialect(value=SybaseASE15Dialect.class, strictMatching=true, - comment = "skip this test on Sybase ASE 15.5, but run it on 15.7, see HHH-6820") + comment = "skip this test on Sybase ASE 15.5, but run it on 15.7, see HHH-6820"), +}) public class LockModeTest extends BaseCoreFunctionalTestCase { private Long id; diff --git a/hibernate-core/src/test/java/org/hibernate/test/map/UserGroup.hbm.xml b/hibernate-core/src/test/java/org/hibernate/test/map/UserGroup.hbm.xml index a2eac87aa0..860ebdfdf6 100755 --- a/hibernate-core/src/test/java/org/hibernate/test/map/UserGroup.hbm.xml +++ b/hibernate-core/src/test/java/org/hibernate/test/map/UserGroup.hbm.xml @@ -20,7 +20,7 @@ - + @@ -41,7 +41,7 @@ select - lower(u.name) as {u.name}, lower(u.password) as {u.password}, + lower(u.name) as {u.name}, lower(u."password") as {u.password}, lower(s.userName) as {s.key}, lower(s.name) as {s.index}, s.id as {s.element}, {s.element.*} from users u diff --git a/hibernate-core/src/test/java/org/hibernate/test/onetoone/formula/Person.hbm.xml b/hibernate-core/src/test/java/org/hibernate/test/onetoone/formula/Person.hbm.xml index 6b179d5dd5..d6b03a7d2c 100755 --- a/hibernate-core/src/test/java/org/hibernate/test/onetoone/formula/Person.hbm.xml +++ b/hibernate-core/src/test/java/org/hibernate/test/onetoone/formula/Person.hbm.xml @@ -25,7 +25,7 @@ - + diff --git a/hibernate-core/src/test/java/org/hibernate/test/querycache/Enrolment.hbm.xml b/hibernate-core/src/test/java/org/hibernate/test/querycache/Enrolment.hbm.xml index 2bf484077d..447c76afe3 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/querycache/Enrolment.hbm.xml +++ b/hibernate-core/src/test/java/org/hibernate/test/querycache/Enrolment.hbm.xml @@ -19,7 +19,7 @@ - + diff --git a/hibernate-core/src/test/java/org/hibernate/test/subclassfilter/Employee.java b/hibernate-core/src/test/java/org/hibernate/test/subclassfilter/Employee.java index d75f730c75..d5e6882369 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/subclassfilter/Employee.java +++ b/hibernate-core/src/test/java/org/hibernate/test/subclassfilter/Employee.java @@ -1,5 +1,6 @@ // $Id: Employee.java 5899 2005-02-24 20:08:04Z steveebersole $ package org.hibernate.test.subclassfilter; +import javax.persistence.Column; import java.util.HashSet; import java.util.Set; @@ -9,6 +10,7 @@ import java.util.Set; * @author Steve Ebersole */ public class Employee extends Person { + @Column(name="`title`") private String title; private String department; private Employee manager; diff --git a/hibernate-core/src/test/java/org/hibernate/test/subclassfilter/UnionSubclassFilterTest.java b/hibernate-core/src/test/java/org/hibernate/test/subclassfilter/UnionSubclassFilterTest.java index d79bf7aefb..46052ba641 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/subclassfilter/UnionSubclassFilterTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/subclassfilter/UnionSubclassFilterTest.java @@ -28,6 +28,8 @@ import java.util.HashSet; import java.util.Iterator; import java.util.List; +import org.hibernate.dialect.TeradataDialect; +import org.hibernate.testing.SkipForDialect; import org.junit.Test; import org.hibernate.Session; @@ -45,6 +47,11 @@ public class UnionSubclassFilterTest extends BaseCoreFunctionalTestCase { } @Test + @SkipForDialect( + value = TeradataDialect.class, + jiraKey = "HHH-8190", + comment = "uses Teradata reserved word - title" + ) @SuppressWarnings( {"unchecked"}) public void testFiltersWithUnionSubclass() { Session s = openSession(); diff --git a/hibernate-core/src/test/java/org/hibernate/test/subclassfilter/discrim-subclass.hbm.xml b/hibernate-core/src/test/java/org/hibernate/test/subclassfilter/discrim-subclass.hbm.xml index ce24c680ac..1ac087d660 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/subclassfilter/discrim-subclass.hbm.xml +++ b/hibernate-core/src/test/java/org/hibernate/test/subclassfilter/discrim-subclass.hbm.xml @@ -19,7 +19,7 @@ - + diff --git a/hibernate-core/src/test/java/org/hibernate/test/subclassfilter/joined-subclass.hbm.xml b/hibernate-core/src/test/java/org/hibernate/test/subclassfilter/joined-subclass.hbm.xml index 6c481161ba..6393ec31ed 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/subclassfilter/joined-subclass.hbm.xml +++ b/hibernate-core/src/test/java/org/hibernate/test/subclassfilter/joined-subclass.hbm.xml @@ -18,7 +18,7 @@ - + diff --git a/hibernate-core/src/test/java/org/hibernate/test/unionsubclass2/UnionSubclassTest.java b/hibernate-core/src/test/java/org/hibernate/test/unionsubclass2/UnionSubclassTest.java index 9059834764..d2868c4142 100755 --- a/hibernate-core/src/test/java/org/hibernate/test/unionsubclass2/UnionSubclassTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/unionsubclass2/UnionSubclassTest.java @@ -26,6 +26,8 @@ package org.hibernate.test.unionsubclass2; import java.math.BigDecimal; import java.util.List; +import org.hibernate.dialect.TeradataDialect; +import org.hibernate.testing.SkipForDialect; import org.junit.Test; import org.hibernate.Hibernate; @@ -50,6 +52,11 @@ public class UnionSubclassTest extends BaseCoreFunctionalTestCase { } @Test + @SkipForDialect( + value = TeradataDialect.class, + jiraKey = "HHH-8190", + comment = "SQL uses Teradata reserved word: title" + ) public void testUnionSubclass() { Session s = openSession(); Transaction t = s.beginTransaction(); @@ -126,6 +133,11 @@ public class UnionSubclassTest extends BaseCoreFunctionalTestCase { } @Test + @SkipForDialect( + value = TeradataDialect.class, + jiraKey = "HHH-8190", + comment = "SQL uses Teradata reserved word: title" + ) public void testQuerySubclassAttribute() { if ( getDialect() instanceof HSQLDialect ) { return; // TODO : why?? @@ -168,6 +180,11 @@ public class UnionSubclassTest extends BaseCoreFunctionalTestCase { } @Test + @SkipForDialect( + value = TeradataDialect.class, + jiraKey = "HHH-8190", + comment = "SQL uses Teradata reserved word: title" + ) public void testCustomColumnReadAndWrite() { Session s = openSession(); Transaction t = s.beginTransaction();