HHH-14744 : HHH-14744 : Refactor contextual information for SchemaManagementTool to be more easily extended by Hibernate Reactive

Move methods from PostgreSQL10Dialect into PostgreSQL81Dialect; remove @GeneratedValue from SchemaUpdateTest
This commit is contained in:
Gail Badner 2021-08-12 18:47:51 -07:00 committed by Sanne Grinovero
parent 3720e5fac4
commit 352eb2fae1
3 changed files with 13 additions and 19 deletions

View File

@ -41,20 +41,8 @@ public class PostgreSQL10Dialect extends PostgreSQL95Dialect {
tableTypesList.add( "PARTITIONED TABLE" );
}
@Override
public NameQualifierSupport getNameQualifierSupport() {
// This method is overridden so the correct value will be returned when
// DatabaseMetaData is not available.
return NameQualifierSupport.SCHEMA;
}
@Override
public SequenceInformationExtractor getSequenceInformationExtractor() {
return SequenceInformationExtractorPostgresSQLDatabaseImpl.INSTANCE;
}
@Override
public String getCurrentSchemaCommand() {
return "select current_schema from sys.dummy";
}
}

View File

@ -32,6 +32,7 @@ import org.hibernate.dialect.pagination.LimitHelper;
import org.hibernate.engine.jdbc.env.spi.IdentifierCaseStrategy;
import org.hibernate.engine.jdbc.env.spi.IdentifierHelper;
import org.hibernate.engine.jdbc.env.spi.IdentifierHelperBuilder;
import org.hibernate.engine.jdbc.env.spi.NameQualifierSupport;
import org.hibernate.engine.spi.RowSelection;
import org.hibernate.exception.LockAcquisitionException;
import org.hibernate.exception.spi.SQLExceptionConversionDelegate;
@ -215,6 +216,18 @@ public class PostgreSQL81Dialect extends Dialect {
return descriptor;
}
@Override
public NameQualifierSupport getNameQualifierSupport() {
// This method is overridden so the correct value will be returned when
// DatabaseMetaData is not available.
return NameQualifierSupport.SCHEMA;
}
@Override
public String getCurrentSchemaCommand() {
return "select current_schema()";
}
@Override
public String getAddColumnString() {
return "add column";

View File

@ -21,7 +21,6 @@ import javax.persistence.Column;
import javax.persistence.ElementCollection;
import javax.persistence.Entity;
import javax.persistence.ForeignKey;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Index;
import javax.persistence.Inheritance;
@ -164,7 +163,6 @@ public class SchemaUpdateTest {
@Table(name = "`testentity`")
public static class LowercaseTableNameEntity {
@Id
@GeneratedValue
long id;
String field1;
@ -175,7 +173,6 @@ public class SchemaUpdateTest {
@Entity(name = "TestEntity1")
public static class TestEntity {
@Id
@GeneratedValue
@Column(name = "`Id`")
long id;
String field1;
@ -195,7 +192,6 @@ public class SchemaUpdateTest {
@Table(name = "`TESTENTITY`")
public static class UppercaseTableNameEntity {
@Id
@GeneratedValue
long id;
String field1;
@ -211,7 +207,6 @@ public class SchemaUpdateTest {
@Table(name = "`TESTentity`", indexes = {@Index(name = "index1", columnList = "`FieLd1`"), @Index(name = "Index2", columnList = "`FIELD_2`")})
public static class MixedCaseTableNameEntity {
@Id
@GeneratedValue
long id;
@Column(name = "`FieLd1`")
String field1;
@ -229,7 +224,6 @@ public class SchemaUpdateTest {
@Entity(name = "Match")
public static class Match {
@Id
@GeneratedValue
long id;
String match;
@ -242,7 +236,6 @@ public class SchemaUpdateTest {
@Inheritance(strategy = InheritanceType.JOINED)
public static class InheritanceRootEntity {
@Id
@GeneratedValue
protected Long id;
}