HHH-8191 Support Teradata 14.0
This commit is contained in:
parent
27e8aae279
commit
027840018b
|
@ -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
|
||||
* <b>the</b> way to bootstrap Hibernate.
|
||||
|
|
|
@ -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<String> 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() {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
@ -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 <tt>FOR UPDATE</tt> syntax
|
||||
* <p/>
|
||||
* {@inheritDoc}
|
||||
* Does this dialect support the <tt>FOR UPDATE</tt> syntax?
|
||||
*
|
||||
* @return empty string ... Teradata does not support <tt>FOR UPDATE<tt> 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
|
||||
* <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 > 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;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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() );
|
||||
|
|
|
@ -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() );
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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" );
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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() {}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -61,7 +61,7 @@ public class Area {
|
|||
this.id = id;
|
||||
}
|
||||
|
||||
@Column(unique = true)
|
||||
@Column(unique = true, nullable=false)
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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<Clothes> hasInside = new HashSet<Clothes>();
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -37,6 +37,7 @@ public class Dvd {
|
|||
this.id = id;
|
||||
}
|
||||
|
||||
@Column(name="`title`")
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ public class Building {
|
|||
this.height = height;
|
||||
}
|
||||
|
||||
@ManyToOne
|
||||
@ManyToOne(optional = false)
|
||||
public Room getRoom() {
|
||||
return room;
|
||||
}
|
||||
|
|
|
@ -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 <bernhardt.manuel@gmail.com>
|
||||
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
<class name="User" table="users">
|
||||
<id name="name"/>
|
||||
<property name="password"/>
|
||||
<property name="password" column="`password`"/>
|
||||
<map name="session" lazy="extra"
|
||||
cascade="persist,save-update,delete,delete-orphan">
|
||||
<key column="userName" not-null="true"/>
|
||||
|
@ -36,7 +36,7 @@
|
|||
</class>
|
||||
|
||||
<class name="Document" table="documents">
|
||||
<id name="title"/>
|
||||
<id name="title" column="`title`"/>
|
||||
<property name="content" type="text"/>
|
||||
<many-to-one name="owner" not-null="true"/>
|
||||
</class>
|
||||
|
@ -55,7 +55,7 @@
|
|||
<return alias="u" class="User"/>
|
||||
<return-join alias="s" property="u.session"/>
|
||||
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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -114,7 +114,7 @@
|
|||
<property name="classification" type="org.hibernate.test.hql.ClassificationType"/>
|
||||
<map name="directors">
|
||||
<key column="directorZoo_id"/>
|
||||
<index type="string" column="title"/>
|
||||
<index type="string" column="`title`"/>
|
||||
<many-to-many class="Human"/>
|
||||
</map>
|
||||
<map name="mammals">
|
||||
|
|
|
@ -25,8 +25,8 @@
|
|||
<id name="id" column="ID" type="long">
|
||||
<generator class="increment"/>
|
||||
</id>
|
||||
<property name="lower" column="lower" type="int"/>
|
||||
<property name="upper" column="upper" type="string"/>
|
||||
<property name="lower" column="`lower`" type="int"/>
|
||||
<property name="upper" column="`upper`" type="string"/>
|
||||
</class>
|
||||
|
||||
<class name="EntityWithNoArgFunctionAsColumn" table="ENTITY_WITH_NOARG_FN_AS_COL">
|
||||
|
|
|
@ -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)" );
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -43,6 +43,6 @@ public class Super {
|
|||
@GeneratedValue(strategy = IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@Column
|
||||
@Column(name="`value`")
|
||||
private Long value;
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
</id>
|
||||
<property name="name" not-null="true" length="50"/>
|
||||
<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="owner" not-null="true" lazy="no-proxy" fetch="select"/>
|
||||
<property name="text" not-null="true" length="2000" lazy="true"/>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
|
||||
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
|
||||
<hibernate-mapping default-lazy="false" package="org.hibernate.test.legacy">
|
||||
<class name="Role">
|
||||
<class name="Role" table="`Role`">
|
||||
|
||||
<id name="id" type="long">
|
||||
<generator class="native"/>
|
||||
|
@ -36,9 +36,9 @@
|
|||
<sql-update callable="true">{? = call updatePatient (?, ?, ?, ?)}</sql-update> -->
|
||||
<!-- <sql-insert callable="true">insert </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-delete>delete from Role where id=?</sql-delete>
|
||||
<sql-delete>delete from "Role" where id=?</sql-delete>
|
||||
|
||||
</class>
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -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' );
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
<class name="User" table="users">
|
||||
<id name="name"/>
|
||||
<property name="password"/>
|
||||
<property name="password" column="`password`"/>
|
||||
<map name="session" cascade="persist,save-update,delete,delete-orphan">
|
||||
<key column="userName" not-null="true"/>
|
||||
<map-key formula="lower(name)" type="string"/>
|
||||
|
@ -41,7 +41,7 @@
|
|||
<return alias="u" class="User"/>
|
||||
<return-join alias="s" property="u.session"/>
|
||||
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
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
<key-property name="type"
|
||||
column="addressType"/>
|
||||
</composite-id>
|
||||
<property name="street" type="text"/>
|
||||
<property name="street"/>
|
||||
<property name="state"/>
|
||||
<property name="zip"/>
|
||||
</class>
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
<class name="CourseMeeting">
|
||||
<composite-id name="id" class="CourseMeetingId">
|
||||
<key-property name="courseCode"/>
|
||||
<key-property name="day"/>
|
||||
<key-property name="day" column="`day`"/>
|
||||
<key-property name="period"/>
|
||||
<key-property name="location"/>
|
||||
</composite-id>
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
<property name="region"/>
|
||||
|
||||
<subclass name="Employee" discriminator-value="1">
|
||||
<property name="title"/>
|
||||
<property name="title" column="`title`"/>
|
||||
<property name="department" column="dept"/>
|
||||
<many-to-one name="manager" column="mgr_id" class="Employee" cascade="none"/>
|
||||
<set name="minions" inverse="true" lazy="true" cascade="all">
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
<joined-subclass name="Employee" table="JEmployee">
|
||||
<key column="person_id"/>
|
||||
|
||||
<property name="title"/>
|
||||
<property name="title" column="`title`"/>
|
||||
<property name="department" column="dept"/>
|
||||
<many-to-one name="manager" class="Employee" column="mgr_id" cascade="none"/>
|
||||
<set name="minions" inverse="true" cascade="all" lazy="true">
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue