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" ); 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 @Override
public SequenceInformationExtractor getSequenceInformationExtractor() { public SequenceInformationExtractor getSequenceInformationExtractor() {
return SequenceInformationExtractorPostgresSQLDatabaseImpl.INSTANCE; 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.IdentifierCaseStrategy;
import org.hibernate.engine.jdbc.env.spi.IdentifierHelper; import org.hibernate.engine.jdbc.env.spi.IdentifierHelper;
import org.hibernate.engine.jdbc.env.spi.IdentifierHelperBuilder; 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.engine.spi.RowSelection;
import org.hibernate.exception.LockAcquisitionException; import org.hibernate.exception.LockAcquisitionException;
import org.hibernate.exception.spi.SQLExceptionConversionDelegate; import org.hibernate.exception.spi.SQLExceptionConversionDelegate;
@ -215,6 +216,18 @@ public class PostgreSQL81Dialect extends Dialect {
return descriptor; 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 @Override
public String getAddColumnString() { public String getAddColumnString() {
return "add column"; return "add column";

View File

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