HHH-10422 - Backport HHH-9983 to fix identity IDs using Oracle12cDialect in 5.0
This commit is contained in:
parent
1ddcc7075f
commit
debc06d54e
|
@ -25,8 +25,6 @@ import java.util.Map;
|
|||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.LockMode;
|
||||
import org.hibernate.LockOptions;
|
||||
|
@ -106,6 +104,8 @@ import org.hibernate.type.StandardBasicTypes;
|
|||
import org.hibernate.type.descriptor.sql.ClobTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
@ -751,108 +751,6 @@ public abstract class Dialect implements ConversionContext {
|
|||
return new IdentityColumnSupportImpl();
|
||||
}
|
||||
|
||||
/**
|
||||
* Does this dialect support identity column key generation?
|
||||
*
|
||||
* @return True if IDENTITY columns are supported; false otherwise.
|
||||
*
|
||||
* @deprecated use {@link IdentityColumnSupport} method instead
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean supportsIdentityColumns() {
|
||||
return getIdentityColumnSupport().supportsIdentityColumns();
|
||||
}
|
||||
|
||||
/**
|
||||
* Does the dialect support some form of inserting and selecting
|
||||
* the generated IDENTITY value all in the same statement.
|
||||
*
|
||||
* @return True if the dialect supports selecting the just
|
||||
* generated IDENTITY in the insert statement.
|
||||
*
|
||||
* @deprecated use {@link IdentityColumnSupport} method instead
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean supportsInsertSelectIdentity() {
|
||||
return getIdentityColumnSupport().supportsInsertSelectIdentity();
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether this dialect have an Identity clause added to the data type or a
|
||||
* completely separate identity data type
|
||||
*
|
||||
* @return boolean
|
||||
*
|
||||
* @deprecated use {@link IdentityColumnSupport} method instead
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean hasDataTypeInIdentityColumn() {
|
||||
return getIdentityColumnSupport().hasDataTypeInIdentityColumn();
|
||||
}
|
||||
|
||||
/**
|
||||
* Provided we {@link #supportsInsertSelectIdentity}, then attach the
|
||||
* "select identity" clause to the insert statement.
|
||||
* <p/>
|
||||
* Note, if {@link #supportsInsertSelectIdentity} == false then
|
||||
* the insert-string should be returned without modification.
|
||||
*
|
||||
* @param insertString The insert command
|
||||
* @return The insert command with any necessary identity select
|
||||
* clause attached.
|
||||
*
|
||||
* @deprecated use {@link IdentityColumnSupport} method instead
|
||||
*/
|
||||
@Deprecated
|
||||
public String appendIdentitySelectToInsert(String insertString) {
|
||||
return getIdentityColumnSupport().appendIdentitySelectToInsert( insertString );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the select command to use to retrieve the last generated IDENTITY
|
||||
* value for a particular table
|
||||
*
|
||||
* @param table The table into which the insert was done
|
||||
* @param column The PK column.
|
||||
* @param type The {@link java.sql.Types} type code.
|
||||
* @return The appropriate select command
|
||||
* @throws MappingException If IDENTITY generation is not supported.
|
||||
*
|
||||
* @deprecated use {@link IdentityColumnSupport} method instead
|
||||
*/
|
||||
@Deprecated
|
||||
public String getIdentitySelectString(String table, String column, int type) throws MappingException {
|
||||
return getIdentityColumnSupport().getIdentitySelectString( table, column, type );
|
||||
}
|
||||
|
||||
/**
|
||||
* The syntax used during DDL to define a column as being an IDENTITY of
|
||||
* a particular type.
|
||||
*
|
||||
* @param type The {@link java.sql.Types} type code.
|
||||
* @return The appropriate DDL fragment.
|
||||
* @throws MappingException If IDENTITY generation is not supported.
|
||||
*
|
||||
* @deprecated use {@link IdentityColumnSupport} method instead
|
||||
*/
|
||||
@Deprecated
|
||||
public String getIdentityColumnString(int type) throws MappingException {
|
||||
return getIdentityColumnSupport().getIdentityColumnString( type );
|
||||
}
|
||||
|
||||
/**
|
||||
* The keyword used to insert a generated value into an identity column (or null).
|
||||
* Need if the dialect does not support inserts that specify no column values.
|
||||
*
|
||||
* @return The appropriate keyword.
|
||||
*
|
||||
* @deprecated use {@link IdentityColumnSupport} method instead
|
||||
*/
|
||||
@Deprecated
|
||||
public String getIdentityInsertString() {
|
||||
return getIdentityColumnSupport().getIdentityInsertString();
|
||||
}
|
||||
|
||||
// SEQUENCE support ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
/**
|
||||
|
|
|
@ -6,6 +6,13 @@
|
|||
*/
|
||||
package org.hibernate.dialect;
|
||||
|
||||
import java.sql.CallableStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Types;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.LockOptions;
|
||||
import org.hibernate.boot.Metadata;
|
||||
|
@ -24,13 +31,6 @@ import org.hibernate.tool.schema.internal.StandardIndexExporter;
|
|||
import org.hibernate.tool.schema.spi.Exporter;
|
||||
import org.hibernate.type.StandardBasicTypes;
|
||||
|
||||
import java.sql.CallableStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Types;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* A dialect for the Teradata database
|
||||
*/
|
||||
|
@ -57,11 +57,6 @@ public class Teradata14Dialect extends TeradataDialect {
|
|||
TeraIndexExporter = new TeradataIndexExporter( this );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsIdentityColumns() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAddColumnString() {
|
||||
return "Add";
|
||||
|
|
|
@ -105,18 +105,17 @@ public class TeradataDialect extends Dialect implements IdTableSupport {
|
|||
*
|
||||
* @return empty string ... Teradata does not support <tt>FOR UPDATE<tt> syntax
|
||||
*/
|
||||
@Override
|
||||
public String getForUpdateString() {
|
||||
return "";
|
||||
}
|
||||
|
||||
public boolean supportsIdentityColumns() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsSequences() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAddColumnString() {
|
||||
return "Add Column";
|
||||
}
|
||||
|
@ -171,22 +170,27 @@ public class TeradataDialect extends Dialect implements IdTableSupport {
|
|||
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";
|
||||
|
||||
|
@ -232,29 +236,31 @@ public class TeradataDialect extends Dialect implements IdTableSupport {
|
|||
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;
|
||||
|
|
|
@ -23,7 +23,7 @@ public interface IdentityColumnSupport {
|
|||
*
|
||||
* @return True if IDENTITY columns are supported; false otherwise.
|
||||
*/
|
||||
public boolean supportsIdentityColumns();
|
||||
boolean supportsIdentityColumns();
|
||||
|
||||
/**
|
||||
* Does the dialect support some form of inserting and selecting
|
||||
|
@ -32,7 +32,7 @@ public interface IdentityColumnSupport {
|
|||
* @return True if the dialect supports selecting the just
|
||||
* generated IDENTITY in the insert statement.
|
||||
*/
|
||||
public boolean supportsInsertSelectIdentity();
|
||||
boolean supportsInsertSelectIdentity();
|
||||
|
||||
/**
|
||||
* Whether this dialect have an Identity clause added to the data type or a
|
||||
|
@ -40,7 +40,7 @@ public interface IdentityColumnSupport {
|
|||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public boolean hasDataTypeInIdentityColumn();
|
||||
boolean hasDataTypeInIdentityColumn();
|
||||
|
||||
/**
|
||||
* Provided we {@link #supportsInsertSelectIdentity}, then attach the
|
||||
|
@ -54,7 +54,7 @@ public interface IdentityColumnSupport {
|
|||
* @return The insert command with any necessary identity select
|
||||
* clause attached.
|
||||
*/
|
||||
public String appendIdentitySelectToInsert(String insertString);
|
||||
String appendIdentitySelectToInsert(String insertString);
|
||||
|
||||
/**
|
||||
* Get the select command to use to retrieve the last generated IDENTITY
|
||||
|
@ -68,7 +68,7 @@ public interface IdentityColumnSupport {
|
|||
*
|
||||
* @throws MappingException If IDENTITY generation is not supported.
|
||||
*/
|
||||
public String getIdentitySelectString(String table, String column, int type) throws MappingException;
|
||||
String getIdentitySelectString(String table, String column, int type) throws MappingException;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -81,7 +81,7 @@ public interface IdentityColumnSupport {
|
|||
*
|
||||
* @throws MappingException If IDENTITY generation is not supported.
|
||||
*/
|
||||
public String getIdentityColumnString(int type) throws MappingException;
|
||||
String getIdentityColumnString(int type) throws MappingException;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -90,7 +90,7 @@ public interface IdentityColumnSupport {
|
|||
*
|
||||
* @return The appropriate keyword.
|
||||
*/
|
||||
public String getIdentityInsertString();
|
||||
String getIdentityInsertString();
|
||||
|
||||
/**
|
||||
* The Delegate for dealing with IDENTITY columns using JDBC3 getGeneratedKeys
|
||||
|
@ -100,7 +100,7 @@ public interface IdentityColumnSupport {
|
|||
*
|
||||
* @return the dialect specific GetGeneratedKeys delegate
|
||||
*/
|
||||
public GetGeneratedKeysDelegate buildGetGeneratedKeysDelegate(
|
||||
GetGeneratedKeysDelegate buildGetGeneratedKeysDelegate(
|
||||
PostInsertIdentityPersister persister,
|
||||
Dialect dialect);
|
||||
}
|
||||
|
|
|
@ -10,6 +10,11 @@ package org.hibernate.dialect.identity;
|
|||
* @author Andrea Boriero
|
||||
*/
|
||||
public class Teradata14IdentityColumnSupport extends IdentityColumnSupportImpl {
|
||||
@Override
|
||||
public boolean supportsIdentityColumns() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIdentityColumnString(int type) {
|
||||
return "generated by default as identity not null";
|
||||
|
|
Loading…
Reference in New Issue