Fix ReSaveReferencedDeletedEntity for CockroachDB and HANA

This commit is contained in:
Christian Beikov 2024-11-27 16:36:07 +01:00
parent e93a07b4f9
commit 32d1455326
3 changed files with 9 additions and 6 deletions

View File

@ -199,7 +199,7 @@ public class PostgreSQLLegacyDialect extends Dialect {
// "long" string types
case LONG32VARCHAR:
case LONG32NVARCHAR:
return "varchar";
return "text";
case BLOB:
case CLOB:
case NCLOB:
@ -232,9 +232,10 @@ public class PostgreSQLLegacyDialect extends Dialect {
case NCHAR:
case VARCHAR:
case NVARCHAR:
return "varchar";
case LONG32VARCHAR:
case LONG32NVARCHAR:
return "varchar";
return "text";
case BINARY:
case VARBINARY:
case LONG32VARBINARY:

View File

@ -220,7 +220,7 @@ public class PostgreSQLDialect extends Dialect {
// since there's no real difference between TEXT and VARCHAR,
// except for the length limit, we can just use 'text' for the
// "long" string types
case LONG32VARCHAR, LONG32NVARCHAR -> "varchar";
case LONG32VARCHAR, LONG32NVARCHAR -> "text";
// use oid as the blob/clob type on Postgres because
// the JDBC driver doesn't allow using bytea/text via
@ -246,7 +246,8 @@ public class PostgreSQLDialect extends Dialect {
@Override
protected String castType(int sqlTypeCode) {
return switch (sqlTypeCode) {
case CHAR, NCHAR, VARCHAR, NVARCHAR, LONG32VARCHAR, LONG32NVARCHAR -> "varchar";
case CHAR, NCHAR, VARCHAR, NVARCHAR -> "varchar";
case LONG32VARCHAR, LONG32NVARCHAR -> "text";
case BINARY, VARBINARY, LONG32VARBINARY -> "bytea";
default -> super.castType( sqlTypeCode );
};

View File

@ -76,8 +76,9 @@ public class ReSaveReferencedDeletedEntity extends BaseCoreFunctionalTestCase {
@Entity(name = "Child")
public static class Child {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@GeneratedValue
private Integer id;
private String name;
public Integer getId() {
return id;
@ -91,7 +92,7 @@ public class ReSaveReferencedDeletedEntity extends BaseCoreFunctionalTestCase {
@Entity(name = "Parent")
public static class Parent {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@GeneratedValue
private Integer id;
@OneToOne(cascade = CascadeType.ALL)