HHH-8191 Support Teradata 14.0

This commit is contained in:
Dave Repshas 2013-04-18 17:32:09 -07:00 committed by Brett Meyer
parent 27e8aae279
commit 027840018b
62 changed files with 535 additions and 189 deletions

View File

@ -23,19 +23,6 @@
*/ */
package org.hibernate.cfg; 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.EmptyInterceptor;
import org.hibernate.HibernateException; import org.hibernate.HibernateException;
import org.hibernate.Interceptor; import org.hibernate.Interceptor;
@ -77,6 +64,19 @@ import org.hibernate.type.SerializationException;
import org.hibernate.usertype.CompositeUserType; import org.hibernate.usertype.CompositeUserType;
import org.hibernate.usertype.UserType; 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 * Represents one approach for bootstrapping Hibernate. In fact, historically this was
* <b>the</b> way to bootstrap Hibernate. * <b>the</b> way to bootstrap Hibernate.

View File

@ -23,23 +23,6 @@
*/ */
package org.hibernate.dialect; 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.HibernateException;
import org.hibernate.LockMode; import org.hibernate.LockMode;
import org.hibernate.LockOptions; 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.LobCreator;
import org.hibernate.engine.jdbc.env.internal.DefaultSchemaNameResolver; import org.hibernate.engine.jdbc.env.internal.DefaultSchemaNameResolver;
import org.hibernate.engine.jdbc.env.spi.SchemaNameResolver; import org.hibernate.engine.jdbc.env.spi.SchemaNameResolver;
import org.hibernate.engine.spi.RowSelection;
import org.hibernate.engine.spi.SessionImplementor; import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.exception.spi.ConversionContext; import org.hibernate.exception.spi.ConversionContext;
import org.hibernate.exception.spi.SQLExceptionConversionDelegate; 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.StandardBasicTypes;
import org.hibernate.type.descriptor.sql.ClobTypeDescriptor; import org.hibernate.type.descriptor.sql.ClobTypeDescriptor;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
import org.jboss.logging.Logger; 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 * 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 * 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. // oddly most database in fact seem to, so true is the default.
return true; return true;
} }
/** /**
* If {@link #supportsTupleDistinctCounts()} is true, does the Dialect require the tuple to be wrapped with parens? * If {@link #supportsTupleDistinctCounts()} is true, does the Dialect require the tuple to be wrapped with parens?
* *
* @return boolean * @return boolean
*/ */
public boolean requiresParensForTupleDistinctCounts() { public boolean requiresParensForTupleDistinctCounts() {
@ -2769,11 +2767,11 @@ public abstract class Dialect implements ConversionContext {
public boolean supportsNotNullUnique() { public boolean supportsNotNullUnique() {
return true; return true;
} }
/** /**
* Apply a hint to the query. The entire query is provided, allowing the Dialect full control over the placement * 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. * 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 query The query to which to apply the hint.
* @param hints The hints to apply * @param hints The hints to apply
* @return The modified SQL * @return The modified SQL
@ -2781,20 +2779,20 @@ public abstract class Dialect implements ConversionContext {
public String getQueryHintString(String query, List<String> hints) { public String getQueryHintString(String query, List<String> hints) {
return query; return query;
} }
/** /**
* Certain dialects support a subset of ScrollModes. Provide a default to be used by Criteria and Query. * Certain dialects support a subset of ScrollModes. Provide a default to be used by Criteria and Query.
* *
* @return ScrollMode * @return ScrollMode
*/ */
public ScrollMode defaultScrollMode() { public ScrollMode defaultScrollMode() {
return ScrollMode.SCROLL_INSENSITIVE; return ScrollMode.SCROLL_INSENSITIVE;
} }
/** /**
* Does this dialect support tuples in subqueries? Ex: * Does this dialect support tuples in subqueries? Ex:
* delete from Table1 where (col1, col2) in (select col1, col2 from Table2) * delete from Table1 where (col1, col2) in (select col1, col2 from Table2)
* *
* @return boolean * @return boolean
*/ */
public boolean supportsTuplesInSubqueries() { public boolean supportsTuplesInSubqueries() {

View File

@ -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
* <tt>java.sql.Types</tt> typecode.
*
* @param code <tt>java.sql.Types</tt> 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;
}
}

View File

@ -37,6 +37,7 @@ import org.hibernate.type.StandardBasicTypes;
* @author Jay Nance * @author Jay Nance
*/ */
public class TeradataDialect extends Dialect { public class TeradataDialect extends Dialect {
private static final int PARAM_LIST_SIZE_LIMIT = 1024; private static final int PARAM_LIST_SIZE_LIMIT = 1024;
/** /**
@ -62,8 +63,7 @@ public class TeradataDialect extends Dialect {
registerColumnType( Types.DATE, "DATE" ); registerColumnType( Types.DATE, "DATE" );
registerColumnType( Types.TIME, "TIME" ); registerColumnType( Types.TIME, "TIME" );
registerColumnType( Types.TIMESTAMP, "TIMESTAMP" ); registerColumnType( Types.TIMESTAMP, "TIMESTAMP" );
// hibernate seems to ignore this type... registerColumnType( Types.BOOLEAN, "BYTEINT" ); // hibernate seems to ignore this type...
registerColumnType( Types.BOOLEAN, "BYTEINT" );
registerColumnType( Types.BLOB, "BLOB" ); registerColumnType( Types.BLOB, "BLOB" );
registerColumnType( Types.CLOB, "CLOB" ); registerColumnType( Types.CLOB, "CLOB" );
@ -113,87 +113,87 @@ public class TeradataDialect extends Dialect {
} }
/** /**
* Teradata does not support <tt>FOR UPDATE</tt> syntax * Does this dialect support the <tt>FOR UPDATE</tt> syntax?
* <p/> *
* {@inheritDoc} * @return empty string ... Teradata does not support <tt>FOR UPDATE<tt> syntax
*/ */
@Override
public String getForUpdateString() { public String getForUpdateString() {
return ""; return "";
} }
@Override
public boolean supportsIdentityColumns() { public boolean supportsIdentityColumns() {
return false; return false;
} }
@Override
public boolean supportsSequences() { public boolean supportsSequences() {
return false; return false;
} }
@Override
public String getAddColumnString() { public String getAddColumnString() {
return "Add Column"; return "Add Column";
} }
@Override
public boolean supportsTemporaryTables() { public boolean supportsTemporaryTables() {
return true; return true;
} }
@Override
public String getCreateTemporaryTableString() { public String getCreateTemporaryTableString() {
return "create global temporary table"; return "create global temporary table";
} }
@Override
public String getCreateTemporaryTablePostfix() { public String getCreateTemporaryTablePostfix() {
return " on commit preserve rows"; return " on commit preserve rows";
} }
@Override
public Boolean performTemporaryTableDDLInIsolation() { public Boolean performTemporaryTableDDLInIsolation() {
return Boolean.TRUE; return Boolean.TRUE;
} }
@Override
public boolean dropTemporaryTableAfterUse() { public boolean dropTemporaryTableAfterUse() {
return false; return false;
} }
@Override /**
public String getTypeName(int code, long length, int precision, int scale) throws HibernateException { * Get the name of the database type associated with the given
// We might want a special case for 19,2. This is very common for money types * <tt>java.sql.Types</tt> typecode.
// and here it is converted to 18,1 *
final float f = precision > 0 ? (float) scale / (float) precision : 0; * @param code <tt>java.sql.Types</tt> typecode
final int p = ( precision > 18 ? 18 : precision ); * @param length the length or precision of the column
final int s = ( precision > 18 ? (int) ( 18.0 * f ) : ( scale > 18 ? 18 : scale ) ); * @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 ); return super.getTypeName( code, length, p, s );
} }
@Override
public boolean supportsCascadeDelete() { public boolean supportsCascadeDelete() {
return false; return false;
} }
@Override
public boolean supportsCircularCascadeDeleteConstraints() { public boolean supportsCircularCascadeDeleteConstraints() {
return false; return false;
} }
@Override
public boolean areStringComparisonsCaseInsensitive() { public boolean areStringComparisonsCaseInsensitive() {
return true; return true;
} }
@Override
public boolean supportsEmptyInList() { public boolean supportsEmptyInList() {
return false; return false;
} }
@Override
public String getSelectClauseNullString(int sqlType) { public String getSelectClauseNullString(int sqlType) {
String v = "null"; String v = "null";
@ -235,39 +235,35 @@ public class TeradataDialect extends Dialect {
case Types.DATALINK: case Types.DATALINK:
case Types.BOOLEAN: case Types.BOOLEAN:
break; break;
default:
break;
} }
return v; return v;
} }
@Override
public String getCreateMultisetTableString() { public String getCreateMultisetTableString() {
return "create multiset table "; return "create multiset table ";
} }
@Override
public boolean supportsLobValueChangePropogation() { public boolean supportsLobValueChangePropogation() {
return false; return false;
} }
@Override
public boolean doesReadCommittedCauseWritersToBlockReaders() { public boolean doesReadCommittedCauseWritersToBlockReaders() {
return true; return true;
} }
@Override
public boolean doesRepeatableReadCauseReadersToBlockWriters() { public boolean doesRepeatableReadCauseReadersToBlockWriters() {
return true; return true;
} }
@Override
public boolean supportsBindAsCallableArgument() { public boolean supportsBindAsCallableArgument() {
return false; return false;
} }
/* (non-Javadoc)
* @see org.hibernate.dialect.Dialect#getInExpressionCountLimit()
*/
@Override @Override
public int getInExpressionCountLimit() { public int getInExpressionCountLimit() {
return PARAM_LIST_SIZE_LIMIT; return PARAM_LIST_SIZE_LIMIT;
} }
} }

View File

@ -92,7 +92,10 @@ public class Select {
} }
if (lockOptions.getLockMode()!=LockMode.NONE) { 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() ); return dialect.transformSelectString( buf.toString() );

View File

@ -187,7 +187,10 @@ public class SimpleSelect {
if (orderBy!=null) buf.append(orderBy); if (orderBy!=null) buf.append(orderBy);
if (lockOptions!=null) { 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() ); return dialect.transformSelectString( buf.toString() );

View File

@ -13,16 +13,16 @@ import javax.persistence.UniqueConstraint;
*/ */
@Entity @Entity
@Table(name = "tbl_sky", @Table(name = "tbl_sky",
uniqueConstraints = {@UniqueConstraint(columnNames = {"month", "day"})} uniqueConstraints = {@UniqueConstraint(columnNames = {"`month`", "`day`"})}
) )
public class Sky implements Serializable { public class Sky implements Serializable {
@Id @Id
protected Long id; protected Long id;
@Column(unique = true, columnDefinition = "varchar(250)", nullable = false) @Column(unique = true, columnDefinition = "varchar(250)", nullable = false)
protected String color; protected String color;
@Column(nullable = false) @Column(name="`day`",nullable = false)
protected String day; protected String day;
@Column(name = "MONTH", nullable = false) @Column(name = "`MONTH`", nullable = false)
protected String month; protected String month;
@Transient @Transient
protected String area; protected String area;

View File

@ -12,7 +12,6 @@ public class CharProperty implements Property {
private String name; private String name;
@Column(name = "`value`")
private Character value; private Character value;
public CharProperty() { public CharProperty() {
@ -43,6 +42,7 @@ public class CharProperty implements Property {
this.id = id; this.id = id;
} }
@Column(name = "`value`")
public Character getValue() { public Character getValue() {
return value; return value;
} }

View File

@ -10,7 +10,6 @@ import javax.persistence.Column;
public class IntegerProperty implements Property { public class IntegerProperty implements Property {
private Integer id; private Integer id;
private String name; private String name;
@Column(name = "`value`")
private Integer value; private Integer value;
public IntegerProperty() { public IntegerProperty() {
@ -41,6 +40,7 @@ public class IntegerProperty implements Property {
this.id = id; this.id = id;
} }
@Column(name = "`value`")
public Integer getValue() { public Integer getValue() {
return value; return value;
} }

View File

@ -11,7 +11,6 @@ public class LongProperty implements Property {
private Integer id; private Integer id;
private String name; private String name;
@Column(name = "`value`")
private Long value; private Long value;
public LongProperty() { public LongProperty() {
@ -42,6 +41,7 @@ public class LongProperty implements Property {
this.id = id; this.id = id;
} }
@Column(name = "`value`")
public Long getValue() { public Long getValue() {
return value; return value;
} }

View File

@ -10,7 +10,6 @@ import javax.persistence.Column;
public class StringProperty implements Property { public class StringProperty implements Property {
private Integer id; private Integer id;
private String name; private String name;
@Column(name = "`value`")
private String value; private String value;
public StringProperty() { public StringProperty() {
@ -41,6 +40,7 @@ public class StringProperty implements Property {
return value; return value;
} }
@Column(name = "`value`")
public String getValue() { public String getValue() {
return value; return value;
} }

View File

@ -1,4 +1,5 @@
package org.hibernate.test.annotations.collectionelement; package org.hibernate.test.annotations.collectionelement;
import javax.persistence.Column;
import javax.persistence.Embeddable; import javax.persistence.Embeddable;
@Embeddable @Embeddable
@ -8,6 +9,7 @@ public class Bug {
private Person reportedBy; private Person reportedBy;
private String summary; private String summary;
@Column(name="`summary`")
public String getSummary() { public String getSummary() {
return summary; return summary;
} }

View File

@ -27,6 +27,8 @@ import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import junit.framework.Assert; import junit.framework.Assert;
import org.hibernate.dialect.TeradataDialect;
import org.hibernate.testing.SkipForDialect;
import org.junit.Test; import org.junit.Test;
import org.hibernate.Session; import org.hibernate.Session;
@ -74,6 +76,11 @@ public class OrderByTest extends BaseCoreFunctionalTestCase {
} }
@Test @Test
@SkipForDialect(
value = TeradataDialect.class,
jiraKey = "HHH-8190",
comment = "uses Teradata reserved word - summary"
)
public void testOrderByWithDottedNotation() throws Exception { public void testOrderByWithDottedNotation() throws Exception {
Session s = openSession(); Session s = openSession();
Transaction tx = s.beginTransaction(); Transaction tx = s.beginTransaction();

View File

@ -11,7 +11,6 @@ import javax.persistence.Column;
@Entity @Entity
public class CorpType { public class CorpType {
private Integer id; private Integer id;
@Column(name = "`type`")
private String type; private String type;
@Id @Id
@ -24,6 +23,7 @@ public class CorpType {
this.id = id; this.id = id;
} }
@Column(name = "`type`")
public String getType() { public String getType() {
return type; return type;
} }

View File

@ -36,6 +36,8 @@ import java.util.Date;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.Set; import java.util.Set;
import org.hibernate.dialect.TeradataDialect;
import org.hibernate.testing.SkipForDialect;
import org.hibernate.AnnotationException; import org.hibernate.AnnotationException;
import org.hibernate.Hibernate; import org.hibernate.Hibernate;
@ -99,6 +101,7 @@ public class BasicHibernateAnnotationsTest extends BaseCoreFunctionalTestCase {
@Test @Test
@RequiresDialectFeature( DialectChecks.SupportsExpectedLobUsagePattern.class ) @RequiresDialectFeature( DialectChecks.SupportsExpectedLobUsagePattern.class )
@SkipForDialect(value = TeradataDialect.class , comment = "One transaction hangs the other")
public void testVersioning() throws Exception { public void testVersioning() throws Exception {
Forest forest = new Forest(); Forest forest = new Forest();
forest.setName( "Fontainebleau" ); forest.setName( "Fontainebleau" );

View File

@ -1,6 +1,7 @@
package org.hibernate.test.annotations.idmanytoone; package org.hibernate.test.annotations.idmanytoone;
import java.io.Serializable; import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.FetchType; import javax.persistence.FetchType;
import javax.persistence.Id; import javax.persistence.Id;
@ -26,6 +27,7 @@ public class CourseStudent implements Serializable {
@JoinColumn(name = "student_id") @JoinColumn(name = "student_id")
private Student student; private Student student;
@Column(name = "`value`")
private String value; private String value;
public CourseStudent() { public CourseStudent() {

View File

@ -12,7 +12,7 @@ import javax.persistence.Table;
* @author Emmanuel Bernard * @author Emmanuel Bernard
*/ */
@Entity @Entity
@Table(name = "ABs") @Table(name = "`ABs`")
@IdClass( StoreCustomerPK.class) @IdClass( StoreCustomerPK.class)
public class StoreCustomer implements Serializable { public class StoreCustomer implements Serializable {
StoreCustomer() {} StoreCustomer() {}

View File

@ -23,6 +23,19 @@
*/ */
package org.hibernate.test.annotations.indexcoll; 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.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
@ -30,18 +43,6 @@ import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; 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.assertEquals;
import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNotNull;
@ -375,6 +376,11 @@ public class IndexedCollectionTest extends BaseNonConfigCoreFunctionalTestCase {
} }
@Test @Test
@SkipForDialect(
value = TeradataDialect.class,
jiraKey = "HHH-8190",
comment = "uses Teradata reserved word - title"
)
public void testMapKeyOnManyToMany() throws Exception { public void testMapKeyOnManyToMany() throws Exception {
Session s; Session s;
s = openSession(); s = openSession();
@ -404,6 +410,11 @@ public class IndexedCollectionTest extends BaseNonConfigCoreFunctionalTestCase {
} }
@Test @Test
@SkipForDialect(
value = TeradataDialect.class,
jiraKey = "HHH-8190",
comment = "uses Teradata reserved word - title"
)
public void testMapKeyOnManyToManyOnId() throws Exception { public void testMapKeyOnManyToManyOnId() throws Exception {
Session s; Session s;
s = openSession(); s = openSession();

View File

@ -37,7 +37,7 @@ import javax.persistence.OneToMany;
import javax.persistence.Table; import javax.persistence.Table;
@Entity @Entity
@Table(name = "ACCOUNT") @Table(name = "`ACCOUNT`")
public class Account implements Serializable { public class Account implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;

View File

@ -35,6 +35,7 @@ import org.hibernate.dialect.DB2Dialect;
import org.hibernate.dialect.HSQLDialect; import org.hibernate.dialect.HSQLDialect;
import org.hibernate.dialect.Oracle8iDialect; import org.hibernate.dialect.Oracle8iDialect;
import org.hibernate.dialect.SQLServer2005Dialect; import org.hibernate.dialect.SQLServer2005Dialect;
import org.hibernate.dialect.TeradataDialect;
import org.hibernate.testing.RequiresDialect; import org.hibernate.testing.RequiresDialect;
import org.hibernate.testing.SkipForDialect; import org.hibernate.testing.SkipForDialect;
import org.hibernate.testing.SkipForDialects; 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 = { HSQLDialect.class }, comment = "The used join conditions does not work in HSQLDB. See HHH-4497." ),
@SkipForDialect( value = { SQLServer2005Dialect.class } ), @SkipForDialect( value = { SQLServer2005Dialect.class } ),
@SkipForDialect( value = { Oracle8iDialect.class }, comment = "Oracle/DB2 do not support 'substring' function" ), @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 { public void testManyToOneFromNonPkToNonPk() throws Exception {
// also tests usage of the stand-alone @JoinFormula annotation (i.e. not wrapped within @JoinColumnsOrFormulas) // also tests usage of the stand-alone @JoinFormula annotation (i.e. not wrapped within @JoinColumnsOrFormulas)
Session s = openSession(); Session s = openSession();

View File

@ -33,7 +33,7 @@ import javax.persistence.Table;
* @author Saša Obradović * @author Saša Obradović
*/ */
@Entity @Entity
@Table(name = "ACCOUNT") @Table(name = "`ACCOUNT`")
@Inheritance(strategy = InheritanceType.JOINED) @Inheritance(strategy = InheritanceType.JOINED)
public class Account extends AccountBase { public class Account extends AccountBase {
public Account() { public Account() {

View File

@ -61,7 +61,7 @@ public class Area {
this.id = id; this.id = id;
} }
@Column(unique = true) @Column(unique = true, nullable=false)
public String getName() { public String getName() {
return name; return name;
} }

View File

@ -30,7 +30,7 @@ import javax.persistence.SqlResultSetMapping;
} }
) )
@NamedNativeQuery(name = "all.dictionaries", @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") resultSetMapping = "dictionary")
public class Dictionary { public class Dictionary {
private Integer id; private Integer id;

View File

@ -243,6 +243,7 @@ public class QueryAndSQLTest extends BaseCoreFunctionalTestCase {
tx = s.beginTransaction(); tx = s.beginTransaction();
Statistics stats = sessionFactory().getStatistics(); Statistics stats = sessionFactory().getStatistics();
stats.setStatisticsEnabled( true ); stats.setStatisticsEnabled( true );
stats.clear();
Query q = s.getNamedQuery( "night&areaCached" ); Query q = s.getNamedQuery( "night&areaCached" );
q.setCacheable( true ); q.setCacheable( true );
List result = q.list(); List result = q.list();

View File

@ -1,6 +1,7 @@
//$Id$ //$Id$
package org.hibernate.test.annotations.referencedcolumnname; package org.hibernate.test.annotations.referencedcolumnname;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.Column;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.Id; import javax.persistence.Id;
@ -10,6 +11,7 @@ import javax.persistence.Id;
@Entity @Entity
public class Clothes { public class Clothes {
private Integer id; private Integer id;
@Column(name = "type")
private String type; private String type;
private String flavor; private String flavor;

View File

@ -4,6 +4,7 @@ import java.io.Serializable;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
import javax.persistence.CascadeType; import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.Id; import javax.persistence.Id;
@ -18,6 +19,7 @@ import javax.persistence.OneToMany;
public class Luggage implements Serializable { public class Luggage implements Serializable {
private Integer id; private Integer id;
private String owner; private String owner;
@Column(name = "`type`")
private String type; private String type;
private Set<Clothes> hasInside = new HashSet<Clothes>(); private Set<Clothes> hasInside = new HashSet<Clothes>();

View File

@ -23,18 +23,19 @@
*/ */
package org.hibernate.test.annotations.referencedcolumnname; package org.hibernate.test.annotations.referencedcolumnname;
import java.math.BigDecimal;
import java.util.Iterator;
import org.hibernate.Session; import org.hibernate.Session;
import org.hibernate.Transaction; import org.hibernate.Transaction;
import org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyJpaImpl; import org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyJpaImpl;
import org.hibernate.cfg.Configuration; import org.hibernate.cfg.Configuration;
import org.hibernate.criterion.Restrictions; import org.hibernate.criterion.Restrictions;
import org.hibernate.dialect.TeradataDialect;
import org.hibernate.testing.SkipForDialect;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import org.junit.Test; import org.junit.Test;
import java.math.BigDecimal;
import java.util.Iterator;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNotNull;
@ -102,6 +103,11 @@ public class ReferencedColumnNameTest extends BaseCoreFunctionalTestCase {
} }
@Test @Test
@SkipForDialect(
value = TeradataDialect.class,
jiraKey = "HHH-8190",
comment = "uses Teradata reserved word - type"
)
public void testUnidirectionalOneToMany() throws Exception { public void testUnidirectionalOneToMany() throws Exception {
Session s; Session s;
Transaction tx; Transaction tx;

View File

@ -37,6 +37,7 @@ public class Dvd {
this.id = id; this.id = id;
} }
@Column(name="`title`")
public String getTitle() { public String getTitle() {
return title; return title;
} }

View File

@ -21,7 +21,7 @@ public class Building {
this.height = height; this.height = height;
} }
@ManyToOne @ManyToOne(optional = false)
public Room getRoom() { public Room getRoom() {
return room; return room;
} }

View File

@ -1,9 +1,11 @@
package org.hibernate.test.annotations.uniqueconstraint; package org.hibernate.test.annotations.uniqueconstraint;
import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.UniqueConstraint; import javax.persistence.UniqueConstraint;
import javax.validation.constraints.NotNull;
/** /**
* @author Manuel Bernhardt <bernhardt.manuel@gmail.com> * @author Manuel Bernhardt <bernhardt.manuel@gmail.com>
@ -11,9 +13,9 @@ import javax.persistence.UniqueConstraint;
@Entity @Entity
@Table(uniqueConstraints = {@UniqueConstraint(name = "uniqueWithInherited", columnNames = {"room_id", "cost"} )}) @Table(uniqueConstraints = {@UniqueConstraint(name = "uniqueWithInherited", columnNames = {"room_id", "cost"} )})
public class House extends Building { public class House extends Building {
@Column(nullable = false)
public Long id; public Long id;
@NotNull
public Integer cost; public Integer cost;
@Id @Id

View File

@ -1,5 +1,6 @@
package org.hibernate.test.annotations.uniqueconstraint; package org.hibernate.test.annotations.uniqueconstraint;
import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.Id; import javax.persistence.Id;
@ -8,7 +9,6 @@ import javax.persistence.Id;
*/ */
@Entity @Entity
public class Room { public class Room {
private Long id; private Long id;
private String name; private String name;
@ -22,6 +22,7 @@ public class Room {
} }
@Id @Id
@Column(nullable = false)
public Long getId() { public Long getId() {
return id; return id;
} }

View File

@ -3,7 +3,6 @@ package org.hibernate.test.annotations.uniqueconstraint;
import org.hibernate.JDBCException; import org.hibernate.JDBCException;
import org.hibernate.Session; import org.hibernate.Session;
import org.hibernate.Transaction; import org.hibernate.Transaction;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import org.junit.Test; import org.junit.Test;
@ -24,7 +23,7 @@ public class UniqueConstraintTest extends BaseCoreFunctionalTestCase {
} }
@Test @Test
public void testUniquenessConstraintWithSuperclassProperty() throws Exception { public void testUniquenessConstraintWithSuperclassProperty() throws Exception {
Session s = openSession(); Session s = openSession();
Transaction tx = s.beginTransaction(); Transaction tx = s.beginTransaction();
Room livingRoom = new Room(); Room livingRoom = new Room();

View File

@ -35,6 +35,7 @@ public class Vehicule {
@Index(name = "thirdone") @Index(name = "thirdone")
private Conductor currentConductor; private Conductor currentConductor;
@Index(name = "year_idx") @Index(name = "year_idx")
@Column(name = "`year`")
private Integer year; private Integer year;
@ManyToOne(optional = true) @ManyToOne(optional = true)
@Index(name = "forthone") @Index(name = "forthone")

View File

@ -22,12 +22,14 @@
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
*/ */
package org.hibernate.test.annotations.xml.ejb3; package org.hibernate.test.annotations.xml.ejb3;
import javax.persistence.Column;
import java.util.Date; import java.util.Date;
/** /**
* @author Emmanuel Bernard * @author Emmanuel Bernard
*/ */
public class CarModel extends Model { public class CarModel extends Model {
@Column(name="`year`")
private Date year; private Date year;
public Date getYear() { public Date getYear() {

View File

@ -33,8 +33,10 @@ import org.hibernate.SessionFactory;
import org.hibernate.Transaction; import org.hibernate.Transaction;
import org.hibernate.dialect.PostgreSQL81Dialect; import org.hibernate.dialect.PostgreSQL81Dialect;
import org.hibernate.dialect.PostgreSQLDialect; import org.hibernate.dialect.PostgreSQLDialect;
import org.hibernate.dialect.TeradataDialect;;
import org.hibernate.persister.collection.BasicCollectionPersister; import org.hibernate.persister.collection.BasicCollectionPersister;
import org.hibernate.testing.SkipForDialect; import org.hibernate.testing.SkipForDialect;
import org.hibernate.testing.SkipForDialects;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
@ -45,8 +47,13 @@ import static org.junit.Assert.assertNotNull;
*/ */
public class Ejb3XmlTest extends BaseCoreFunctionalTestCase { public class Ejb3XmlTest extends BaseCoreFunctionalTestCase {
@Test @Test
@SkipForDialects ( {
@SkipForDialect(value = { PostgreSQL81Dialect.class, PostgreSQLDialect.class }, @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 { public void testEjb3Xml() throws Exception {
Session s = openSession(); Session s = openSession();
Transaction tx = s.beginTransaction(); Transaction tx = s.beginTransaction();

View File

@ -24,12 +24,14 @@
package org.hibernate.test.event.collection.detached; package org.hibernate.test.event.collection.detached;
import javax.persistence.CascadeType; import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.Index; import javax.persistence.Index;
import javax.persistence.JoinColumn; import javax.persistence.JoinColumn;
import javax.persistence.JoinTable; import javax.persistence.JoinTable;
import javax.persistence.ManyToMany; import javax.persistence.ManyToMany;
import javax.persistence.Table;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -37,6 +39,7 @@ import java.util.List;
* @author Steve Ebersole * @author Steve Ebersole
*/ */
@Entity @Entity
@Table(name="`Alias`")
public class Alias implements Identifiable { public class Alias implements Identifiable {
private Integer id; private Integer id;
private String alias; private String alias;
@ -60,6 +63,7 @@ public class Alias implements Identifiable {
this.id = id; this.id = id;
} }
@Column(name="`alias`")
public String getAlias() { public String getAlias() {
return alias; return alias;
} }

View File

@ -21,7 +21,7 @@
<class name="User" table="users"> <class name="User" table="users">
<id name="name"/> <id name="name"/>
<property name="password"/> <property name="password" column="`password`"/>
<map name="session" lazy="extra" <map name="session" lazy="extra"
cascade="persist,save-update,delete,delete-orphan"> cascade="persist,save-update,delete,delete-orphan">
<key column="userName" not-null="true"/> <key column="userName" not-null="true"/>
@ -36,7 +36,7 @@
</class> </class>
<class name="Document" table="documents"> <class name="Document" table="documents">
<id name="title"/> <id name="title" column="`title`"/>
<property name="content" type="text"/> <property name="content" type="text"/>
<many-to-one name="owner" not-null="true"/> <many-to-one name="owner" not-null="true"/>
</class> </class>
@ -55,7 +55,7 @@
<return alias="u" class="User"/> <return alias="u" class="User"/>
<return-join alias="s" property="u.session"/> <return-join alias="s" property="u.session"/>
select 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}, lower(s.userName) as {s.key}, lower(s.name) as {s.index}, s.id as {s.element},
{s.element.*} {s.element.*}
from users u from users u

View File

@ -24,6 +24,7 @@
package org.hibernate.test.flush; package org.hibernate.test.flush;
import javax.persistence.CascadeType; import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.Id; import javax.persistence.Id;
@ -59,6 +60,7 @@ public class Book {
this.id = id; this.id = id;
} }
@Column(name="`title`")
public String getTitle() { public String getTitle() {
return title; return title;
} }

View File

@ -23,18 +23,6 @@
*/ */
package org.hibernate.test.hql; 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.Hibernate;
import org.hibernate.HibernateException; import org.hibernate.HibernateException;
import org.hibernate.Query; import org.hibernate.Query;
@ -61,23 +49,11 @@ import org.hibernate.dialect.Sybase11Dialect;
import org.hibernate.dialect.SybaseASE15Dialect; import org.hibernate.dialect.SybaseASE15Dialect;
import org.hibernate.dialect.SybaseAnywhereDialect; import org.hibernate.dialect.SybaseAnywhereDialect;
import org.hibernate.dialect.SybaseDialect; import org.hibernate.dialect.SybaseDialect;
import org.hibernate.dialect.TeradataDialect;
import org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory; import org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory;
import org.hibernate.internal.util.StringHelper; import org.hibernate.internal.util.StringHelper;
import org.hibernate.persister.entity.DiscriminatorType; import org.hibernate.persister.entity.DiscriminatorType;
import org.hibernate.stat.QueryStatistics; 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.IntegerPropertyValue;
import org.hibernate.test.any.PropertySet; import org.hibernate.test.any.PropertySet;
import org.hibernate.test.any.PropertyValue; 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.LineItem.Id;
import org.hibernate.test.cid.Order; import org.hibernate.test.cid.Order;
import org.hibernate.test.cid.Product; 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.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.hibernate.testing.junit4.ExtraAssertions.assertClassAssignability;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
@ -2542,7 +2541,7 @@ public class ASTParserLoadingTest extends BaseCoreFunctionalTestCase {
an.setBodyWeight(123.45f); an.setBodyWeight(123.45f);
session.persist( an ); session.persist( an );
String str = (String) session.createQuery("select str(an.bodyWeight) from Animal an where str(an.bodyWeight) like '%1%'").uniqueResult(); 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") ); assertTrue( str.startsWith("1.234") );
} }
else //noinspection deprecation else //noinspection deprecation
@ -2560,7 +2559,7 @@ public class ASTParserLoadingTest extends BaseCoreFunctionalTestCase {
} }
//noinspection deprecation //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 // In TransactSQL (the variant spoken by Sybase and SQLServer), the str() function
// is explicitly intended for numeric values only... // is explicitly intended for numeric values only...
String dateStr1 = (String) session.createQuery("select str(current_date) from Animal").uniqueResult(); String dateStr1 = (String) session.createQuery("select str(current_date) from Animal").uniqueResult();

View File

@ -114,7 +114,7 @@
<property name="classification" type="org.hibernate.test.hql.ClassificationType"/> <property name="classification" type="org.hibernate.test.hql.ClassificationType"/>
<map name="directors"> <map name="directors">
<key column="directorZoo_id"/> <key column="directorZoo_id"/>
<index type="string" column="title"/> <index type="string" column="`title`"/>
<many-to-many class="Human"/> <many-to-many class="Human"/>
</map> </map>
<map name="mammals"> <map name="mammals">

View File

@ -25,8 +25,8 @@
<id name="id" column="ID" type="long"> <id name="id" column="ID" type="long">
<generator class="increment"/> <generator class="increment"/>
</id> </id>
<property name="lower" column="lower" type="int"/> <property name="lower" column="`lower`" type="int"/>
<property name="upper" column="upper" type="string"/> <property name="upper" column="`upper`" type="string"/>
</class> </class>
<class name="EntityWithNoArgFunctionAsColumn" table="ENTITY_WITH_NOARG_FN_AS_COL"> <class name="EntityWithNoArgFunctionAsColumn" table="ENTITY_WITH_NOARG_FN_AS_COL">

View File

@ -49,6 +49,7 @@ import org.hibernate.dialect.Sybase11Dialect;
import org.hibernate.dialect.SybaseASE15Dialect; import org.hibernate.dialect.SybaseASE15Dialect;
import org.hibernate.dialect.SybaseAnywhereDialect; import org.hibernate.dialect.SybaseAnywhereDialect;
import org.hibernate.dialect.SybaseDialect; import org.hibernate.dialect.SybaseDialect;
import org.hibernate.dialect.TeradataDialect;
import org.hibernate.dialect.function.SQLFunction; import org.hibernate.dialect.function.SQLFunction;
import org.hibernate.engine.query.spi.HQLQueryPlan; import org.hibernate.engine.query.spi.HQLQueryPlan;
import org.hibernate.engine.query.spi.ReturnMetadata; 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 a where abs(:param - a.bodyWeight) < 2.0");
assertTranslation("from Animal where abs(:x - :y) < 2.0"); assertTranslation("from Animal where abs(:x - :y) < 2.0");
assertTranslation("from Animal where lower(upper(:foo)) like 'f%'"); 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; // Transact-SQL dialects (except SybaseAnywhereDialect) map the length function -> len;
// classic translator does not consider that *when nested*; // classic translator does not consider that *when nested*;
// SybaseAnywhereDialect supports the length function // SybaseAnywhereDialect supports the length function
assertTranslation("from Animal a where abs(abs(a.bodyWeight - 1.0 + :param) * abs(length('ffobar')-3)) = 3.0"); 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%'"); 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; return;
} }
if ( getDialect() instanceof AbstractHANADialect ) { if ( getDialect() instanceof AbstractHANADialect ) {
@ -846,6 +847,7 @@ public class HQLTest extends QueryTranslatorTestCase {
public void testGroupByFunction() { public void testGroupByFunction() {
if ( getDialect() instanceof Oracle8iDialect ) return; // the new hiearchy... if ( getDialect() instanceof Oracle8iDialect ) return; // the new hiearchy...
if ( getDialect() instanceof PostgreSQLDialect || getDialect() instanceof PostgreSQL81Dialect ) return; if ( getDialect() instanceof PostgreSQLDialect || getDialect() instanceof PostgreSQL81Dialect ) return;
if ( getDialect() instanceof TeradataDialect) return;
if ( ! H2Dialect.class.isInstance( getDialect() ) ) { if ( ! H2Dialect.class.isInstance( getDialect() ) ) {
// H2 has no year function // H2 has no year function
assertTranslation( "select count(*) from Human h group by year(h.birthdate)" ); assertTranslation( "select count(*) from Human h group by year(h.birthdate)" );

View File

@ -1,11 +1,21 @@
package org.hibernate.test.hqlfetchscroll; package org.hibernate.test.hqlfetchscroll;
import static org.junit.Assert.assertEquals; import org.hibernate.Hibernate;
import static org.junit.Assert.assertNotNull; import org.hibernate.ScrollableResults;
import static org.junit.Assert.assertNull; import org.hibernate.Session;
import static org.junit.Assert.assertSame; import org.hibernate.Transaction;
import static org.junit.Assert.assertTrue; import org.hibernate.dialect.AbstractHANADialect;
import static org.junit.Assert.fail; 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.ArrayList;
import java.util.HashSet; import java.util.HashSet;
@ -13,21 +23,12 @@ import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import org.hibernate.Hibernate; import static org.junit.Assert.assertEquals;
import org.hibernate.ScrollableResults; import static org.junit.Assert.assertNotNull;
import org.hibernate.Session; import static org.junit.Assert.assertNull;
import org.hibernate.Transaction; import static org.junit.Assert.assertSame;
import org.hibernate.dialect.DB2Dialect; import static org.junit.Assert.assertTrue;
import org.hibernate.dialect.H2Dialect; import static org.junit.Assert.fail;
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;
@SkipForDialect( value = { Oracle8iDialect.class, AbstractHANADialect.class }, @SkipForDialect( value = { Oracle8iDialect.class, AbstractHANADialect.class },
comment = "Oracle/HANA do not support the identity column used in the mapping. Extended by NoIdentityHQLScrollFetchTest" ) 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 @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() { public void testScroll() {
Session s = openSession(); Session s = openSession();
ScrollableResults results = s.createQuery( QUERY ).scroll(); ScrollableResults results = s.createQuery( QUERY ).scroll();

View File

@ -43,6 +43,6 @@ public class Super {
@GeneratedValue(strategy = IDENTITY) @GeneratedValue(strategy = IDENTITY)
private Long id; private Long id;
@Column @Column(name="`value`")
private Long value; private Long value;
} }

View File

@ -48,7 +48,7 @@
</id> </id>
<property name="name" not-null="true" length="50"/> <property name="name" not-null="true" length="50"/>
<property name="upperCaseName" formula="upper(name)" lazy="true"/> <property name="upperCaseName" formula="upper(name)" lazy="true"/>
<property name="summary" not-null="true" length="200" lazy="true"/> <property name="summary" column="`summary`" not-null="true" length="200" lazy="true"/>
<many-to-one name="folder" not-null="true" lazy="no-proxy"/> <many-to-one name="folder" not-null="true" lazy="no-proxy"/>
<many-to-one name="owner" not-null="true" lazy="no-proxy" fetch="select"/> <many-to-one name="owner" not-null="true" lazy="no-proxy" fetch="select"/>
<property name="text" not-null="true" length="2000" lazy="true"/> <property name="text" not-null="true" length="2000" lazy="true"/>

View File

@ -43,7 +43,7 @@ import javax.persistence.Table;
@NamedNativeQuery(name = "DestinationEntity.update", query = "update destination_entity set from_id=:idFrom, fullNameFrom=:fullName" @NamedNativeQuery(name = "DestinationEntity.update", query = "update destination_entity set from_id=:idFrom, fullNameFrom=:fullName"
+ " where id in (:ids)"), + " where id in (:ids)"),
@NamedNativeQuery(name = "DestinationEntity.delete", query = "delete from destination_entity 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 { public class DestinationEntity {
@Id @Id

View File

@ -3,7 +3,7 @@
"-//Hibernate/Hibernate Mapping DTD 3.0//EN" "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<hibernate-mapping default-lazy="false" package="org.hibernate.test.legacy"> <hibernate-mapping default-lazy="false" package="org.hibernate.test.legacy">
<class name="Role"> <class name="Role" table="`Role`">
<id name="id" type="long"> <id name="id" type="long">
<generator class="native"/> <generator class="native"/>
@ -36,9 +36,9 @@
<sql-update callable="true">{? = call updatePatient (?, ?, ?, ?)}</sql-update> --> <sql-update callable="true">{? = call updatePatient (?, ?, ?, ?)}</sql-update> -->
<!-- <sql-insert callable="true">insert </sql-insert> --> <!-- <sql-insert callable="true">insert </sql-insert> -->
<!-- <sql-delete>delete from Role where values (?, upper(?)) /** i did this */</sql-insert> --> <!-- <sql-delete>delete from Role where values (?, upper(?)) /** i did this */</sql-insert> -->
<sql-insert>insert into Role (name, id) values (?, upper(?)) /** i did this */</sql-insert> <sql-insert>insert into "Role" (name, id) values (?, upper(?)) /** i did this */</sql-insert>
<!-- <sql-update>update</sql-update>--> <!-- <sql-update>update</sql-update>-->
<sql-delete>delete from Role where id=?</sql-delete> <sql-delete>delete from "Role" where id=?</sql-delete>
</class> </class>

View File

@ -85,6 +85,7 @@ import org.hibernate.dialect.SAPDBDialect;
import org.hibernate.dialect.Sybase11Dialect; import org.hibernate.dialect.Sybase11Dialect;
import org.hibernate.dialect.SybaseASE15Dialect; import org.hibernate.dialect.SybaseASE15Dialect;
import org.hibernate.dialect.SybaseDialect; import org.hibernate.dialect.SybaseDialect;
import org.hibernate.dialect.TeradataDialect;
import org.hibernate.dialect.TimesTenDialect; import org.hibernate.dialect.TimesTenDialect;
import org.hibernate.engine.jdbc.connections.spi.ConnectionProvider; import org.hibernate.engine.jdbc.connections.spi.ConnectionProvider;
import org.hibernate.engine.spi.SessionImplementor; 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" "select foo.foo.foo.foo from Foo foo, Foo foo2 where"
+ " foo = foo2.foo and not not ( not foo.string='fizard' )" + " foo = foo2.foo and not not ( not foo.string='fizard' )"
+ " and foo2.string between 'a' and (foo.foo.string)" + " 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') or 1=1 )"
: :
" and ( foo2.string in ( 'fiz', 'blah', foo.foo.string, foo.string, foo2.string ) )" " 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(bar);
s.save(baz); s.save(baz);
list = s.createQuery( 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(); ).list();
assertTrue( "query many-to-one", list.size()==1 ); assertTrue( "query many-to-one", list.size()==1 );
list = s.createQuery( " from Bar i where i.baz.name='Bazza'" ).list(); list = s.createQuery( " from Bar i where i.baz.name='Bazza'" ).list();

View File

@ -34,6 +34,7 @@ import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.hibernate.testing.SkipForDialect;
import org.junit.Test; import org.junit.Test;
import org.hibernate.Criteria; import org.hibernate.Criteria;
@ -49,6 +50,7 @@ import org.hibernate.criterion.Restrictions;
import org.hibernate.dialect.HSQLDialect; import org.hibernate.dialect.HSQLDialect;
import org.hibernate.dialect.IngresDialect; import org.hibernate.dialect.IngresDialect;
import org.hibernate.dialect.MySQLDialect; import org.hibernate.dialect.MySQLDialect;
import org.hibernate.dialect.TeradataDialect;
import org.hibernate.engine.spi.EntityEntry; import org.hibernate.engine.spi.EntityEntry;
import org.hibernate.internal.SessionImpl; import org.hibernate.internal.SessionImpl;
import org.hibernate.jdbc.AbstractWork; import org.hibernate.jdbc.AbstractWork;
@ -1200,7 +1202,7 @@ public class ParentChildTest extends LegacyTestCase {
s.close(); s.close();
} }
@Test @Test
public void testLoadAfterNonExists() throws HibernateException, SQLException { public void testLoadAfterNonExists() throws HibernateException, SQLException {
Session session = openSession(); Session session = openSession();
if ( ( getDialect() instanceof MySQLDialect ) || ( getDialect() instanceof IngresDialect ) ) { if ( ( getDialect() instanceof MySQLDialect ) || ( getDialect() instanceof IngresDialect ) ) {
@ -1221,6 +1223,10 @@ public class ParentChildTest extends LegacyTestCase {
fail(); fail();
} }
catch(ObjectNotFoundException onfe) { catch(ObjectNotFoundException onfe) {
if ( getDialect() instanceof TeradataDialect ){
session.getTransaction().rollback();
session.getTransaction().begin();
}
// this is correct // this is correct
} }

View File

@ -31,6 +31,7 @@ import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.hibernate.dialect.TeradataDialect;
import org.jboss.logging.Logger; import org.jboss.logging.Logger;
import org.junit.Test; import org.junit.Test;
@ -550,7 +551,7 @@ public class SQLFunctionsTest extends LegacyTestCase {
@Test @Test
public void testBlobClob() throws Exception { public void testBlobClob() throws Exception {
// Sybase does not support ResultSet.getBlob(String) // 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; return;
} }
Session s = openSession(); Session s = openSession();

View File

@ -25,6 +25,8 @@ package org.hibernate.test.lob;
import java.sql.Blob; import java.sql.Blob;
import junit.framework.AssertionFailedError; import junit.framework.AssertionFailedError;
import org.hibernate.dialect.TeradataDialect;
import org.hibernate.testing.SkipForDialect;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
@ -54,6 +56,11 @@ public class BlobLocatorTest extends BaseCoreFunctionalTestCase {
} }
@Test @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 { public void testBoundedBlobLocatorAccess() throws Throwable {
byte[] original = buildByteArray( BLOB_SIZE, true ); byte[] original = buildByteArray( BLOB_SIZE, true );
byte[] changed = buildByteArray( BLOB_SIZE, false ); byte[] changed = buildByteArray( BLOB_SIZE, false );

View File

@ -25,6 +25,8 @@ package org.hibernate.test.lob;
import java.sql.Clob; import java.sql.Clob;
import org.hibernate.dialect.TeradataDialect;
import org.hibernate.testing.SkipForDialect;
import org.junit.Test; import org.junit.Test;
import org.hibernate.LockMode; import org.hibernate.LockMode;
@ -57,6 +59,11 @@ public class ClobLocatorTest extends BaseCoreFunctionalTestCase {
} }
@Test @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 { public void testBoundedClobLocatorAccess() throws Throwable {
String original = buildString( CLOB_SIZE, 'x' ); String original = buildString( CLOB_SIZE, 'x' );
String changed = buildString( CLOB_SIZE, 'y' ); String changed = buildString( CLOB_SIZE, 'y' );

View File

@ -23,6 +23,7 @@
*/ */
package org.hibernate.test.locking; package org.hibernate.test.locking;
import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.Id; import javax.persistence.Id;
@ -57,6 +58,7 @@ public class A {
this.id = id; this.id = id;
} }
@Column(name="`value`")
public String getValue() { public String getValue() {
return value; return value;
} }

View File

@ -25,6 +25,8 @@ package org.hibernate.test.locking;
import java.util.concurrent.TimeoutException; import java.util.concurrent.TimeoutException;
import org.hibernate.dialect.TeradataDialect;
import org.hibernate.testing.SkipForDialects;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
@ -51,8 +53,10 @@ import static org.junit.Assert.fail;
* @author Steve Ebersole * @author Steve Ebersole
*/ */
@TestForIssue( jiraKey = "HHH-5275") @TestForIssue( jiraKey = "HHH-5275")
@SkipForDialects( {
@SkipForDialect(value=SybaseASE15Dialect.class, strictMatching=true, @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 { public class LockModeTest extends BaseCoreFunctionalTestCase {
private Long id; private Long id;

View File

@ -20,7 +20,7 @@
<class name="User" table="users"> <class name="User" table="users">
<id name="name"/> <id name="name"/>
<property name="password"/> <property name="password" column="`password`"/>
<map name="session" cascade="persist,save-update,delete,delete-orphan"> <map name="session" cascade="persist,save-update,delete,delete-orphan">
<key column="userName" not-null="true"/> <key column="userName" not-null="true"/>
<map-key formula="lower(name)" type="string"/> <map-key formula="lower(name)" type="string"/>
@ -41,7 +41,7 @@
<return alias="u" class="User"/> <return alias="u" class="User"/>
<return-join alias="s" property="u.session"/> <return-join alias="s" property="u.session"/>
select 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}, lower(s.userName) as {s.key}, lower(s.name) as {s.index}, s.id as {s.element},
{s.element.*} {s.element.*}
from users u from users u

View File

@ -25,7 +25,7 @@
<key-property name="type" <key-property name="type"
column="addressType"/> column="addressType"/>
</composite-id> </composite-id>
<property name="street" type="text"/> <property name="street"/>
<property name="state"/> <property name="state"/>
<property name="zip"/> <property name="zip"/>
</class> </class>

View File

@ -19,7 +19,7 @@
<class name="CourseMeeting"> <class name="CourseMeeting">
<composite-id name="id" class="CourseMeetingId"> <composite-id name="id" class="CourseMeetingId">
<key-property name="courseCode"/> <key-property name="courseCode"/>
<key-property name="day"/> <key-property name="day" column="`day`"/>
<key-property name="period"/> <key-property name="period"/>
<key-property name="location"/> <key-property name="location"/>
</composite-id> </composite-id>

View File

@ -1,5 +1,6 @@
// $Id: Employee.java 5899 2005-02-24 20:08:04Z steveebersole $ // $Id: Employee.java 5899 2005-02-24 20:08:04Z steveebersole $
package org.hibernate.test.subclassfilter; package org.hibernate.test.subclassfilter;
import javax.persistence.Column;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
@ -9,6 +10,7 @@ import java.util.Set;
* @author Steve Ebersole * @author Steve Ebersole
*/ */
public class Employee extends Person { public class Employee extends Person {
@Column(name="`title`")
private String title; private String title;
private String department; private String department;
private Employee manager; private Employee manager;

View File

@ -28,6 +28,8 @@ import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import org.hibernate.dialect.TeradataDialect;
import org.hibernate.testing.SkipForDialect;
import org.junit.Test; import org.junit.Test;
import org.hibernate.Session; import org.hibernate.Session;
@ -45,6 +47,11 @@ public class UnionSubclassFilterTest extends BaseCoreFunctionalTestCase {
} }
@Test @Test
@SkipForDialect(
value = TeradataDialect.class,
jiraKey = "HHH-8190",
comment = "uses Teradata reserved word - title"
)
@SuppressWarnings( {"unchecked"}) @SuppressWarnings( {"unchecked"})
public void testFiltersWithUnionSubclass() { public void testFiltersWithUnionSubclass() {
Session s = openSession(); Session s = openSession();

View File

@ -19,7 +19,7 @@
<property name="region"/> <property name="region"/>
<subclass name="Employee" discriminator-value="1"> <subclass name="Employee" discriminator-value="1">
<property name="title"/> <property name="title" column="`title`"/>
<property name="department" column="dept"/> <property name="department" column="dept"/>
<many-to-one name="manager" column="mgr_id" class="Employee" cascade="none"/> <many-to-one name="manager" column="mgr_id" class="Employee" cascade="none"/>
<set name="minions" inverse="true" lazy="true" cascade="all"> <set name="minions" inverse="true" lazy="true" cascade="all">

View File

@ -18,7 +18,7 @@
<joined-subclass name="Employee" table="JEmployee"> <joined-subclass name="Employee" table="JEmployee">
<key column="person_id"/> <key column="person_id"/>
<property name="title"/> <property name="title" column="`title`"/>
<property name="department" column="dept"/> <property name="department" column="dept"/>
<many-to-one name="manager" class="Employee" column="mgr_id" cascade="none"/> <many-to-one name="manager" class="Employee" column="mgr_id" cascade="none"/>
<set name="minions" inverse="true" cascade="all" lazy="true"> <set name="minions" inverse="true" cascade="all" lazy="true">

View File

@ -26,6 +26,8 @@ package org.hibernate.test.unionsubclass2;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.List; import java.util.List;
import org.hibernate.dialect.TeradataDialect;
import org.hibernate.testing.SkipForDialect;
import org.junit.Test; import org.junit.Test;
import org.hibernate.Hibernate; import org.hibernate.Hibernate;
@ -50,6 +52,11 @@ public class UnionSubclassTest extends BaseCoreFunctionalTestCase {
} }
@Test @Test
@SkipForDialect(
value = TeradataDialect.class,
jiraKey = "HHH-8190",
comment = "SQL uses Teradata reserved word: title"
)
public void testUnionSubclass() { public void testUnionSubclass() {
Session s = openSession(); Session s = openSession();
Transaction t = s.beginTransaction(); Transaction t = s.beginTransaction();
@ -126,6 +133,11 @@ public class UnionSubclassTest extends BaseCoreFunctionalTestCase {
} }
@Test @Test
@SkipForDialect(
value = TeradataDialect.class,
jiraKey = "HHH-8190",
comment = "SQL uses Teradata reserved word: title"
)
public void testQuerySubclassAttribute() { public void testQuerySubclassAttribute() {
if ( getDialect() instanceof HSQLDialect ) { if ( getDialect() instanceof HSQLDialect ) {
return; // TODO : why?? return; // TODO : why??
@ -168,6 +180,11 @@ public class UnionSubclassTest extends BaseCoreFunctionalTestCase {
} }
@Test @Test
@SkipForDialect(
value = TeradataDialect.class,
jiraKey = "HHH-8190",
comment = "SQL uses Teradata reserved word: title"
)
public void testCustomColumnReadAndWrite() { public void testCustomColumnReadAndWrite() {
Session s = openSession(); Session s = openSession();
Transaction t = s.beginTransaction(); Transaction t = s.beginTransaction();