diff --git a/.github/workflows/contributor-build.yml b/.github/workflows/contributor-build.yml index 9a6d016ba0..c6376dedbf 100644 --- a/.github/workflows/contributor-build.yml +++ b/.github/workflows/contributor-build.yml @@ -37,7 +37,9 @@ jobs: experimental: false - rdbms: mariadb experimental: false - - rdbms: postgresql + - rdbms: postgresql_9_5 + experimental: false + - rdbms: postgresql_13 experimental: false - rdbms: oracle experimental: false diff --git a/Jenkinsfile b/Jenkinsfile index 78969503ec..e5db903889 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -27,7 +27,8 @@ stage('Configure') { buildEnv('8', 'derby'), buildEnv('8', 'mysql8'), buildEnv('8', 'mariadb'), - buildEnv('8', 'postgresql'), + buildEnv('8', 'postgresql_9_5'), + buildEnv('8', 'postgresql_13'), buildEnv('8', 'oracle'), buildEnv('8', 'oracle_ee'), buildEnv('8', 'db2'), @@ -84,14 +85,22 @@ stage('Build') { sh "./docker_db.sh mariadb" containerName = "mariadb" break; - case "postgresql": + case "postgresql_9_5": // use the postgis image to enable the PGSQL GIS (spatial) extension docker.withRegistry('https://index.docker.io/v1/', 'hibernateci.hub.docker.com') { - docker.image('postgis:9.5-3.0').pull() + docker.image('postgis/postgis:9.5-2.5').pull() } sh "./docker_db.sh postgresql_9_5" containerName = "postgres" break; + case "postgresql_13": + // use the postgis image to enable the PGSQL GIS (spatial) extension + docker.withRegistry('https://index.docker.io/v1/', 'hibernateci.hub.docker.com') { + docker.image('postgis/postgis:13-3.1').pull() + } + sh "./docker_db.sh postgresql_13" + containerName = "postgres" + break; case "oracle": docker.withRegistry('https://index.docker.io/v1/', 'hibernateci.hub.docker.com') { docker.image('quillbuilduser/oracle-18-xe').pull() @@ -144,7 +153,8 @@ stage('Build') { case "mysql8": goal = "-Pdb=mysql_ci" break; - case "postgresql": + case "postgresql_9_5": + case "postgresql_13": goal = "-Pdb=pgsql_ci" break; case "oracle": diff --git a/ci/build.sh b/ci/build.sh index 4a5cc015a7..27c847f80c 100755 --- a/ci/build.sh +++ b/ci/build.sh @@ -9,7 +9,9 @@ elif [ "$RDBMS" == "mysql" ]; then goal="-Pdb=mysql_ci" elif [ "$RDBMS" == "mariadb" ]; then goal="-Pdb=mariadb_ci" -elif [ "$RDBMS" == "postgresql" ]; then +elif [ "$RDBMS" == "postgresql_9_5" ]; then + goal="-Pdb=pgsql_ci" +elif [ "$RDBMS" == "postgresql_13" ]; then goal="-Pdb=pgsql_ci" elif [ "$RDBMS" == "oracle" ]; then # I have no idea why, but these tests don't work on GH Actions diff --git a/ci/database-start.sh b/ci/database-start.sh index c53022fab2..b77e7780b6 100755 --- a/ci/database-start.sh +++ b/ci/database-start.sh @@ -8,8 +8,10 @@ elif [ "$RDBMS" == 'mysql8' ]; then bash $DIR/../docker_db.sh mysql_8_0 elif [ "$RDBMS" == 'mariadb' ]; then bash $DIR/../docker_db.sh mariadb -elif [ "$RDBMS" == 'postgresql' ]; then +elif [ "$RDBMS" == 'postgresql_9_5' ]; then bash $DIR/../docker_db.sh postgresql_9_5 +elif [ "$RDBMS" == 'postgresql_13' ]; then + bash $DIR/../docker_db.sh postgresql_13 elif [ "$RDBMS" == 'db2' ]; then bash $DIR/../docker_db.sh db2 elif [ "$RDBMS" == 'oracle' ]; then diff --git a/docker_db.sh b/docker_db.sh index 958a362d82..cdbf1f60ac 100755 --- a/docker_db.sh +++ b/docker_db.sh @@ -73,12 +73,12 @@ mariadb() { postgresql_9_5() { docker rm -f postgres || true - docker run --name postgres -e POSTGRES_USER=hibernate_orm_test -e POSTGRES_PASSWORD=hibernate_orm_test -e POSTGRES_DB=hibernate_orm_test -p5432:5432 -d postgres:9.5 + docker run --name postgres -e POSTGRES_USER=hibernate_orm_test -e POSTGRES_PASSWORD=hibernate_orm_test -e POSTGRES_DB=hibernate_orm_test -p5432:5432 -d postgis/postgis:9.5-2.5 } postgresql_13() { docker rm -f postgres || true - docker run --name postgres -e POSTGRES_USER=hibernate_orm_test -e POSTGRES_PASSWORD=hibernate_orm_test -e POSTGRES_DB=hibernate_orm_test -p5432:5432 -d postgres:13.0 + docker run --name postgres -e POSTGRES_USER=hibernate_orm_test -e POSTGRES_PASSWORD=hibernate_orm_test -e POSTGRES_DB=hibernate_orm_test -p5432:5432 -d postgis/postgis:13-3.1 } edb() { diff --git a/documentation/documentation.gradle b/documentation/documentation.gradle index eaca4be4ea..b80f1ef7f4 100644 --- a/documentation/documentation.gradle +++ b/documentation/documentation.gradle @@ -292,7 +292,6 @@ tasks.withType(AsciidoctorTask).all { test { include '**/**' - exclude '**/HQLTest**' } // resources inherently exclude sources diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/CaseStatementDiscriminatorMappingImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/CaseStatementDiscriminatorMappingImpl.java index 85621a7762..09589034c2 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/CaseStatementDiscriminatorMappingImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/CaseStatementDiscriminatorMappingImpl.java @@ -9,7 +9,6 @@ package org.hibernate.metamodel.mapping.internal; import java.util.LinkedHashMap; import java.util.Map; -import org.hibernate.metamodel.mapping.EntityDiscriminatorMapping; import org.hibernate.metamodel.mapping.JdbcMapping; import org.hibernate.persister.entity.DiscriminatorType; import org.hibernate.persister.entity.JoinedSubclassEntityPersister; @@ -78,7 +77,7 @@ public class CaseStatementDiscriminatorMappingImpl extends AbstractDiscriminator SqlAstCreationState creationState) { final SqlExpressionResolver expressionResolver = creationState.getSqlExpressionResolver(); return expressionResolver.resolveSqlExpression( - createColumnReferenceKey( tableGroup.getGroupAlias(), EntityDiscriminatorMapping.ROLE_NAME ), + createColumnReferenceKey( tableGroup.getPrimaryTableReference(), getSelectionExpression() ), sqlAstProcessingState -> createCaseSearchedExpression( tableGroup ) ); } @@ -87,13 +86,7 @@ public class CaseStatementDiscriminatorMappingImpl extends AbstractDiscriminator final CaseSearchedExpression caseSearchedExpression = new CaseSearchedExpression( this ); tableDiscriminatorDetailsMap.forEach( (tableName, tableDiscriminatorDetails) -> { - TableReference tableReference; - try { - tableReference = entityTableGroup.resolveTableReference( entityTableGroup.getNavigablePath(), tableName ); - } - catch (Exception e) { - tableReference = null; - } + final TableReference tableReference = entityTableGroup.getTableReference( entityTableGroup.getNavigablePath(), tableName ); if ( tableReference == null ) { // assume this is because it is a table that is not part of the processing entity's sub-hierarchy @@ -142,10 +135,9 @@ public class CaseStatementDiscriminatorMappingImpl extends AbstractDiscriminator @Override public String getSelectionExpression() { - throw new UnsupportedOperationException(); -// // this *should* only be used to create the sql-expression key, so just -// // using the ROLE_NAME should be fine -// return ROLE_NAME; + // this *should* only be used to create the sql-expression key, so just + // using the ROLE_NAME should be fine + return ROLE_NAME; } diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/ExplicitColumnDiscriminatorMappingImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/ExplicitColumnDiscriminatorMappingImpl.java index 0df0f9a6d6..42e2bf6349 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/ExplicitColumnDiscriminatorMappingImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/ExplicitColumnDiscriminatorMappingImpl.java @@ -54,14 +54,13 @@ public class ExplicitColumnDiscriminatorMappingImpl extends AbstractDiscriminato TableGroup tableGroup, SqlAstCreationState creationState) { final SqlExpressionResolver expressionResolver = creationState.getSqlExpressionResolver(); - final TableReference tableReference = tableGroup.resolveTableReference( navigablePath, tableExpression ); - + final String selectionExpression = getSelectionExpression(); return expressionResolver.resolveSqlExpression( - createColumnReferenceKey( tableReference, EntityDiscriminatorMapping.ROLE_NAME ), + createColumnReferenceKey( tableReference, selectionExpression ), sqlAstProcessingState -> new ColumnReference( tableReference, - columnFormula == null ? columnName : columnFormula, + selectionExpression, columnFormula != null, null, null,