From fa261190ecee6ad4e094fb4ae29523ef8f02a9d0 Mon Sep 17 00:00:00 2001 From: Gavin King Date: Thu, 17 Sep 2020 14:10:38 +0200 Subject: [PATCH 01/16] HHH-14240 Stop generating fragments of uppercase SQL Hibernate generates lowercase SQL. (Note that I already fixed all this in H6, but not in H5.) --- .../hibernate/dialect/InterbaseDialect.java | 8 +- .../hibernate/dialect/MariaDB103Dialect.java | 2 +- .../hibernate/dialect/Oracle8iDialect.java | 2 +- .../dialect/SQLServer2012Dialect.java | 2 +- .../hibernate/dialect/SQLServerDialect.java | 2 +- .../dialect/hint/IndexQueryHintHandler.java | 2 +- .../pagination/Informix10LimitHandler.java | 114 ++++---- .../pagination/SQLServer2005LimitHandler.java | 18 +- .../dialect/InformixLimitHandlerTestCase.java | 10 +- .../dialect/SQLServer2005DialectTestCase.java | 258 +++++++++--------- .../dialect/SQLServer2012DialectTestCase.java | 4 +- .../jpa/test/query/NamedQueryCommentTest.java | 2 +- 12 files changed, 212 insertions(+), 212 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/InterbaseDialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/InterbaseDialect.java index 89958c5142..418753ed76 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/InterbaseDialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/InterbaseDialect.java @@ -77,7 +77,7 @@ public class InterbaseDialect extends Dialect { @Override public String getSequenceNextValString(String sequenceName) { - return "select " + getSelectSequenceNextValString( sequenceName ) + " from RDB$DATABASE"; + return "select " + getSelectSequenceNextValString( sequenceName ) + " from rdb$database"; } @Override @@ -92,12 +92,12 @@ public class InterbaseDialect extends Dialect { @Override public String getDropSequenceString(String sequenceName) { - return "delete from RDB$GENERATORS where RDB$GENERATOR_NAME = '" + sequenceName.toUpperCase(Locale.ROOT) + "'"; + return "delete from rdb$generators where rdb$generator_name = '" + sequenceName.toUpperCase(Locale.ROOT) + "'"; } @Override public String getQuerySequencesString() { - return "select RDB$GENERATOR_NAME from RDB$GENERATORS"; + return "select rdb$generator_name from rdb$generators"; } @Override @@ -150,7 +150,7 @@ public class InterbaseDialect extends Dialect { // TODO : not sure which (either?) is correct, could not find docs on how to do this. // did find various blogs and forums mentioning that select CURRENT_TIMESTAMP // does not work... - return "{?= call CURRENT_TIMESTAMP }"; + return "{?= call current_timestamp }"; // return "select CURRENT_TIMESTAMP from RDB$DATABASE"; } diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/MariaDB103Dialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/MariaDB103Dialect.java index a2e0de9dca..b0731980ae 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/MariaDB103Dialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/MariaDB103Dialect.java @@ -76,7 +76,7 @@ public class MariaDB103Dialect extends MariaDB102Dialect { @Override public String getQuerySequencesString() { - return "select table_name from information_schema.TABLES where table_schema = database() and table_type = 'SEQUENCE'"; + return "select table_name from information_schema.tables where table_schema = database() and table_type = 'SEQUENCE'"; } @Override diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/Oracle8iDialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/Oracle8iDialect.java index 5f0c25bac2..8cba9cff59 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/Oracle8iDialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/Oracle8iDialect.java @@ -745,7 +745,7 @@ public class Oracle8iDialect extends Dialect { @Override public String getCurrentSchemaCommand() { - return "SELECT SYS_CONTEXT('USERENV', 'CURRENT_SCHEMA') FROM DUAL"; + return "select sys_context('USERENV', 'CURRENT_SCHEMA') from dual"; } @Override diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/SQLServer2012Dialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/SQLServer2012Dialect.java index 90c461ac46..5ecc7b3b81 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/SQLServer2012Dialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/SQLServer2012Dialect.java @@ -49,7 +49,7 @@ public class SQLServer2012Dialect extends SQLServer2008Dialect { @Override public String getQuerySequencesString() { // The upper-case name should work on both case-sensitive and case-insensitive collations. - return "select * from INFORMATION_SCHEMA.SEQUENCES"; + return "select * from information_schema.sequences"; } @Override diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/SQLServerDialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/SQLServerDialect.java index 7ac92fe1ac..2c9542a003 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/SQLServerDialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/SQLServerDialect.java @@ -124,7 +124,7 @@ public class SQLServerDialect extends AbstractTransactSQLDialect { @Override public String getCurrentSchemaCommand() { - return "SELECT SCHEMA_NAME()"; + return "select schema_name()"; } @Override diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/hint/IndexQueryHintHandler.java b/hibernate-core/src/main/java/org/hibernate/dialect/hint/IndexQueryHintHandler.java index 36ce81083a..26c004c008 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/hint/IndexQueryHintHandler.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/hint/IndexQueryHintHandler.java @@ -35,7 +35,7 @@ public class IndexQueryHintHandler implements QueryHintHandler { String endToken = matcher.group( 2 ); return new StringBuilder( startToken ) - .append( " USE INDEX (" ) + .append( " use index (" ) .append( hints ) .append( ") " ) .append( endToken ) diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/pagination/Informix10LimitHandler.java b/hibernate-core/src/main/java/org/hibernate/dialect/pagination/Informix10LimitHandler.java index eecf677f42..3943b483f7 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/pagination/Informix10LimitHandler.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/pagination/Informix10LimitHandler.java @@ -1,57 +1,57 @@ -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * License: GNU Lesser General Public License (LGPL), version 2.1 or later. - * See the lgpl.txt file in the root directory or . - */ -package org.hibernate.dialect.pagination; - -import java.util.Locale; - -import org.hibernate.engine.spi.RowSelection; - -public class Informix10LimitHandler extends AbstractLimitHandler { - - public static final Informix10LimitHandler INSTANCE = new Informix10LimitHandler(); - - private Informix10LimitHandler() { - // Disallow instantiation - } - - @Override - public String processSql(String sql, RowSelection selection) { - final boolean hasOffset = LimitHelper.hasFirstRow( selection ); - String sqlOffset = hasOffset ? " SKIP " + selection.getFirstRow() : ""; - String sqlLimit = " FIRST " + getMaxOrLimit( selection ); - String sqlOffsetLimit = sqlOffset + sqlLimit; - String result = new StringBuilder( sql.length() + 10 ) - .append( sql ) - .insert( sql.toLowerCase( Locale.ROOT ).indexOf( "select" ) + 6, sqlOffsetLimit ).toString(); - return result; - } - - @Override - public boolean supportsLimit() { - return true; - } - - @Override - public boolean bindLimitParametersFirst() { - return true; - } - - @Override - public boolean useMaxForLimit() { - return false; - } - - @Override - public boolean supportsLimitOffset() { - return true; - } - - @Override - public boolean supportsVariableLimit() { - return false; - } -} +/* + * Hibernate, Relational Persistence for Idiomatic Java + * + * License: GNU Lesser General Public License (LGPL), version 2.1 or later. + * See the lgpl.txt file in the root directory or . + */ +package org.hibernate.dialect.pagination; + +import java.util.Locale; + +import org.hibernate.engine.spi.RowSelection; + +public class Informix10LimitHandler extends AbstractLimitHandler { + + public static final Informix10LimitHandler INSTANCE = new Informix10LimitHandler(); + + private Informix10LimitHandler() { + // Disallow instantiation + } + + @Override + public String processSql(String sql, RowSelection selection) { + final boolean hasOffset = LimitHelper.hasFirstRow( selection ); + String sqlOffset = hasOffset ? " skip " + selection.getFirstRow() : ""; + String sqlLimit = " first " + getMaxOrLimit( selection ); + String sqlOffsetLimit = sqlOffset + sqlLimit; + String result = new StringBuilder( sql.length() + 10 ) + .append( sql ) + .insert( sql.toLowerCase( Locale.ROOT ).indexOf( "select" ) + 6, sqlOffsetLimit ).toString(); + return result; + } + + @Override + public boolean supportsLimit() { + return true; + } + + @Override + public boolean bindLimitParametersFirst() { + return true; + } + + @Override + public boolean useMaxForLimit() { + return false; + } + + @Override + public boolean supportsLimitOffset() { + return true; + } + + @Override + public boolean supportsVariableLimit() { + return false; + } +} diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/pagination/SQLServer2005LimitHandler.java b/hibernate-core/src/main/java/org/hibernate/dialect/pagination/SQLServer2005LimitHandler.java index 789f6c3c22..147488cdb0 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/pagination/SQLServer2005LimitHandler.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/pagination/SQLServer2005LimitHandler.java @@ -97,10 +97,10 @@ public class SQLServer2005LimitHandler extends AbstractLimitHandler { *
 	 * WITH query AS (
 	 *   SELECT inner_query.*
-	 *        , ROW_NUMBER() OVER (ORDER BY CURRENT_TIMESTAMP) as __hibernate_row_nr__
+	 *        , ROW_NUMBER() OVER (ORDER BY CURRENT_TIMESTAMP) as __row__
 	 *     FROM ( original_query_with_top_if_order_by_present_and_all_aliased_columns ) inner_query
 	 * )
-	 * SELECT alias_list FROM query WHERE __hibernate_row_nr__ >= offset AND __hibernate_row_nr__ < offset + last
+	 * SELECT alias_list FROM query WHERE __row__ >= offset AND __row__ < offset + last
 	 * 
* * When offset equals {@literal 0}, only TOP(?) expression is added to the original query. @@ -131,9 +131,9 @@ public class SQLServer2005LimitHandler extends AbstractLimitHandler { encloseWithOuterQuery( sb, offset ); - sb.insert( offset, !isCTE ? "WITH query AS (" : ", query AS (" ); - sb.append( ") SELECT " ).append( selectClause ).append( " FROM query " ); - sb.append( "WHERE __hibernate_row_nr__ >= ? AND __hibernate_row_nr__ < ?" ); + sb.insert( offset, !isCTE ? "with query as (" : ", query as (" ); + sb.append( ") select " ).append( selectClause ).append( " from query " ); + sb.append( "where __row__ >= ? and __row__ < ?" ); } return sb.toString(); @@ -298,13 +298,13 @@ public class SQLServer2005LimitHandler extends AbstractLimitHandler { } /** - * Encloses original SQL statement with outer query that provides {@literal __hibernate_row_nr__} column. + * Encloses original SQL statement with outer query that provides {@literal __row__} column. * * @param sql SQL query. * @param offset SQL query offset. */ protected void encloseWithOuterQuery(StringBuilder sql, int offset) { - sql.insert( offset, "SELECT inner_query.*, ROW_NUMBER() OVER (ORDER BY CURRENT_TIMESTAMP) as __hibernate_row_nr__ FROM ( " ); + sql.insert( offset, "select inner_query.*, row_number() over (order by current_timestamp) as __row__ from ( " ); sql.append( " ) inner_query " ); } @@ -321,11 +321,11 @@ public class SQLServer2005LimitHandler extends AbstractLimitHandler { final int selectDistinctPos = shallowIndexOfPattern( sql, SELECT_DISTINCT_PATTERN, offset ); if ( selectPos == selectDistinctPos ) { // Place TOP after SELECT DISTINCT - sql.insert( selectDistinctPos + SELECT_DISTINCT.length(), " TOP(?)" ); + sql.insert( selectDistinctPos + SELECT_DISTINCT.length(), " top(?)" ); } else { // Place TOP after SELECT - sql.insert( selectPos + SELECT.length(), " TOP(?)" ); + sql.insert( selectPos + SELECT.length(), " top(?)" ); } topAdded = true; } diff --git a/hibernate-core/src/test/java/org/hibernate/dialect/InformixLimitHandlerTestCase.java b/hibernate-core/src/test/java/org/hibernate/dialect/InformixLimitHandlerTestCase.java index 2633fbe14a..32f017488d 100644 --- a/hibernate-core/src/test/java/org/hibernate/dialect/InformixLimitHandlerTestCase.java +++ b/hibernate-core/src/test/java/org/hibernate/dialect/InformixLimitHandlerTestCase.java @@ -19,7 +19,7 @@ public class InformixLimitHandlerTestCase extends private Informix10LimitHandler informixLimitHandler; - private final String TEST_SQL = "SELECT field FROM table"; + private final String TEST_SQL = "select field from table"; @Before public void setup() { @@ -29,10 +29,10 @@ public class InformixLimitHandlerTestCase extends @Test @TestForIssue(jiraKey = "HHH-11509") public void testCorrectLimit() { - assertLimitHandlerEquals( "SELECT FIRST 10 field FROM table", 0, 10 ); - assertLimitHandlerEquals( "SELECT SKIP 3 FIRST 5 field FROM table", 3, 5 ); - assertLimitHandlerEquals( "SELECT SKIP 10 FIRST 5 field FROM table", 10, 5 ); - assertLimitHandlerEquals( "SELECT SKIP 55 FIRST 12 field FROM table", 55, 12 ); + assertLimitHandlerEquals( "select first 10 field from table", 0, 10 ); + assertLimitHandlerEquals( "select skip 3 first 5 field from table", 3, 5 ); + assertLimitHandlerEquals( "select skip 10 first 5 field from table", 10, 5 ); + assertLimitHandlerEquals( "select skip 55 first 12 field from table", 55, 12 ); } private void assertLimitHandlerEquals(String sql, int firstRow, int maxRows) { diff --git a/hibernate-core/src/test/java/org/hibernate/dialect/SQLServer2005DialectTestCase.java b/hibernate-core/src/test/java/org/hibernate/dialect/SQLServer2005DialectTestCase.java index e84df4a5bc..474dd7aa83 100644 --- a/hibernate-core/src/test/java/org/hibernate/dialect/SQLServer2005DialectTestCase.java +++ b/hibernate-core/src/test/java/org/hibernate/dialect/SQLServer2005DialectTestCase.java @@ -45,19 +45,19 @@ public class SQLServer2005DialectTestCase extends BaseUnitTestCase { String input = "select distinct f1 as f53245 from table849752 order by f234, f67 desc"; assertEquals( - "with query as (select inner_query.*, row_number() over (order by current_timestamp) as __hibernate_row_nr__ from ( " + + "with query as (select inner_query.*, row_number() over (order by current_timestamp) as __row__ from ( " + "select distinct top(?) f1 as f53245 from table849752 order by f234, f67 desc ) inner_query )" + - " select f53245 from query where __hibernate_row_nr__ >= ? and __hibernate_row_nr__ < ?", + " select f53245 from query where __row__ >= ? and __row__ < ?", dialect.getLimitHandler().processSql( input, toRowSelection( 10, 15 ) ).toLowerCase(Locale.ROOT) ); } @Test @TestForIssue(jiraKey = "HHH-10736") public void testGetLimitStringWithNewlineAfterSelect() { - final String query = "select" + System.lineSeparator() + "* FROM Employee E WHERE E.firstName = :firstName"; + final String query = "select" + System.lineSeparator() + "* from Employee E where E.firstName = :firstName"; assertEquals( - "WITH query AS (SELECT inner_query.*, ROW_NUMBER() OVER (ORDER BY CURRENT_TIMESTAMP) as __hibernate_row_nr__ FROM ( " + - query + " ) inner_query ) SELECT * FROM query WHERE __hibernate_row_nr__ >= ? AND __hibernate_row_nr__ < ?", + "with query as (select inner_query.*, row_number() over (order by current_timestamp) as __row__ from ( " + + query + " ) inner_query ) select * from query where __row__ >= ? and __row__ < ?", dialect.getLimitHandler().processSql( query, toRowSelection( 1, 25 ) ) ); } @@ -65,10 +65,10 @@ public class SQLServer2005DialectTestCase extends BaseUnitTestCase { @Test @TestForIssue(jiraKey = "HHH-10736") public void testGetLimitStringWithNewlineAfterSelectWithMultipleSpaces() { - final String query = "select " + System.lineSeparator() + "* FROM Employee E WHERE E.firstName = :firstName"; + final String query = "select " + System.lineSeparator() + "* from employee e where e.firstName = :firstName"; assertEquals( - "WITH query AS (SELECT inner_query.*, ROW_NUMBER() OVER (ORDER BY CURRENT_TIMESTAMP) as __hibernate_row_nr__ FROM ( " + - query + " ) inner_query ) SELECT * FROM query WHERE __hibernate_row_nr__ >= ? AND __hibernate_row_nr__ < ?", + "with query as (select inner_query.*, row_number() over (order by current_timestamp) as __row__ from ( " + + query + " ) inner_query ) select * from query where __row__ >= ? and __row__ < ?", dialect.getLimitHandler().processSql( query, toRowSelection( 1, 25 ) ) ); } @@ -76,12 +76,12 @@ public class SQLServer2005DialectTestCase extends BaseUnitTestCase { @Test @TestForIssue(jiraKey = "HHH-8507") public void testGetLimitStringWithNewlineAfterColumnList() { - final String query = "select E.fieldA,E.fieldB\r\nFROM Employee E WHERE E.firstName = :firstName"; + final String query = "select e.fielda,e.fieldb\r\nfrom employee e where e.firstname = :firstname"; assertEquals( - "WITH query AS (SELECT inner_query.*, ROW_NUMBER() OVER (ORDER BY CURRENT_TIMESTAMP) as __hibernate_row_nr__ FROM ( " + - "select E.fieldA as page0_,E.fieldB as page1_\r\n" + - "FROM Employee E WHERE E.firstName = :firstName ) inner_query ) SELECT page0_, page1_ FROM query " + - "WHERE __hibernate_row_nr__ >= ? AND __hibernate_row_nr__ < ?", + "with query as (select inner_query.*, row_number() over (order by current_timestamp) as __row__ from ( " + + "select e.fielda as page0_,e.fieldb as page1_\r\n" + + "from employee e where e.firstname = :firstname ) inner_query ) select page0_, page1_ from query " + + "where __row__ >= ? and __row__ < ?", dialect.getLimitHandler().processSql( query, toRowSelection( 1, 25 ) ) ); } @@ -96,9 +96,9 @@ public class SQLServer2005DialectTestCase extends BaseUnitTestCase { "where persistent0_.customerid=?"; assertEquals( - "WITH query AS (SELECT inner_query.*, ROW_NUMBER() OVER (ORDER BY CURRENT_TIMESTAMP) as __hibernate_row_nr__ FROM ( " + + "with query as (select inner_query.*, row_number() over (order by current_timestamp) as __row__ from ( " + fromColumnNameSQL + " ) inner_query ) " + - "SELECT rid1688_, deviati16_1688_, sortindex1688_ FROM query WHERE __hibernate_row_nr__ >= ? AND __hibernate_row_nr__ < ?", + "select rid1688_, deviati16_1688_, sortindex1688_ from query where __row__ >= ? and __row__ < ?", dialect.getLimitHandler().processSql( fromColumnNameSQL, toRowSelection( 1, 10 ) ) ); } @@ -109,9 +109,9 @@ public class SQLServer2005DialectTestCase extends BaseUnitTestCase { final String notAliasedSQL = "select column1, column2, column3, column4 from table1"; assertEquals( - "WITH query AS (SELECT inner_query.*, ROW_NUMBER() OVER (ORDER BY CURRENT_TIMESTAMP) as __hibernate_row_nr__ FROM ( " + + "with query as (select inner_query.*, row_number() over (order by current_timestamp) as __row__ from ( " + "select column1 as page0_, column2 as page1_, column3 as page2_, column4 as page3_ from table1 ) inner_query ) " + - "SELECT page0_, page1_, page2_, page3_ FROM query WHERE __hibernate_row_nr__ >= ? AND __hibernate_row_nr__ < ?", + "select page0_, page1_, page2_, page3_ from query where __row__ >= ? and __row__ < ?", dialect.getLimitHandler().processSql( notAliasedSQL, toRowSelection( 3, 5 ) ) ); } @@ -121,9 +121,9 @@ public class SQLServer2005DialectTestCase extends BaseUnitTestCase { public void testGetLimitStringAliasGenerationWithAliasesNoAs() { final String aliasedSQLNoAs = "select column1 c1, column c2, column c3, column c4 from table1"; assertEquals( - "WITH query AS (SELECT inner_query.*, ROW_NUMBER() OVER (ORDER BY CURRENT_TIMESTAMP) as __hibernate_row_nr__ FROM ( " + + "with query as (select inner_query.*, row_number() over (order by current_timestamp) as __row__ from ( " + "select column1 c1, column c2, column c3, column c4 from table1 ) inner_query ) " + - "SELECT c1, c2, c3, c4 FROM query WHERE __hibernate_row_nr__ >= ? AND __hibernate_row_nr__ < ?", + "select c1, c2, c3, c4 from query where __row__ >= ? and __row__ < ?", dialect.getLimitHandler().processSql( aliasedSQLNoAs, toRowSelection( 3, 5 ) ) ); } @@ -132,9 +132,9 @@ public class SQLServer2005DialectTestCase extends BaseUnitTestCase { @TestForIssue(jiraKey = "HHH-11352") public void testPagingWithColumnNameStartingWithFrom() { final String sql = "select column1 c1, from_column c2 from table1"; - assertEquals( "WITH query AS (SELECT inner_query.*, ROW_NUMBER() OVER (ORDER BY CURRENT_TIMESTAMP) as __hibernate_row_nr__ FROM ( " + + assertEquals( "with query as (select inner_query.*, row_number() over (order by current_timestamp) as __row__ from ( " + "select column1 c1, from_column c2 from table1 ) inner_query ) " + - "SELECT c1, c2 FROM query WHERE __hibernate_row_nr__ >= ? AND __hibernate_row_nr__ < ?", + "select c1, c2 from query where __row__ >= ? and __row__ < ?", dialect.getLimitHandler().processSql(sql, toRowSelection(3, 5))); } @@ -149,9 +149,9 @@ public class SQLServer2005DialectTestCase extends BaseUnitTestCase { "where persistent0_.type='v'"; assertEquals( - "WITH query AS (SELECT inner_query.*, ROW_NUMBER() OVER (ORDER BY CURRENT_TIMESTAMP) as __hibernate_row_nr__ FROM ( " + + "with query as (select inner_query.*, row_number() over (order by current_timestamp) as __row__ from ( " + subselectInSelectClauseSQL + " ) inner_query ) " + - "SELECT col_0_0_, col_1_0_ FROM query WHERE __hibernate_row_nr__ >= ? AND __hibernate_row_nr__ < ?", + "select col_0_0_, col_1_0_ from query where __row__ >= ? and __row__ < ?", dialect.getLimitHandler().processSql( subselectInSelectClauseSQL, toRowSelection( 2, 5 ) ) ); } @@ -159,14 +159,14 @@ public class SQLServer2005DialectTestCase extends BaseUnitTestCase { @Test @TestForIssue(jiraKey = "HHH-11084") public void testGetLimitStringWithSelectDistinctSubselect() { - final String selectDistinctSubselectSQL = "select page0_.CONTENTID as CONTENT1_12_ " + - "where page0_.CONTENTTYPE='PAGE' and (page0_.CONTENTID in " + - "(select distinct page2_.PREVVER from CONTENT page2_ where (page2_.PREVVER is not null)))"; + final String selectDistinctSubselectSQL = "select page0_.contentid as content1_12_ " + + "where page0_.contenttype='page' and (page0_.contentid in " + + "(select distinct page2_.prevver from content page2_ where (page2_.prevver is not null)))"; assertEquals( - "select TOP(?) page0_.CONTENTID as CONTENT1_12_ " + - "where page0_.CONTENTTYPE='PAGE' and (page0_.CONTENTID in " + - "(select distinct page2_.PREVVER from CONTENT page2_ where (page2_.PREVVER is not null)))", + "select top(?) page0_.contentid as content1_12_ " + + "where page0_.contenttype='page' and (page0_.contentid in " + + "(select distinct page2_.prevver from content page2_ where (page2_.prevver is not null)))", dialect.getLimitHandler().processSql( selectDistinctSubselectSQL, toRowSelection( 0, 5 ) ) ); } @@ -174,14 +174,14 @@ public class SQLServer2005DialectTestCase extends BaseUnitTestCase { @Test @TestForIssue(jiraKey = "HHH-11084") public void testGetLimitStringWithSelectDistinctSubselectNotFirst() { - final String selectDistinctSubselectSQL = "select page0_.CONTENTID as CONTENT1_12_ FROM CONTEXT page0_ " + - "where page0_.CONTENTTYPE='PAGE' and (page0_.CONTENTID in " + - "(select distinct page2_.PREVVER from CONTENT page2_ where (page2_.PREVVER is not null)))"; + final String selectDistinctSubselectSQL = "select page0_.contentid as content1_12_ from context page0_ " + + "where page0_.contenttype='page' and (page0_.contentid in " + + "(select distinct page2_.prevver from content page2_ where (page2_.prevver is not null)))"; assertEquals( - "WITH query AS (SELECT inner_query.*, ROW_NUMBER() OVER (ORDER BY CURRENT_TIMESTAMP) as __hibernate_row_nr__ " + - "FROM ( " + selectDistinctSubselectSQL + " ) inner_query ) " + - "SELECT CONTENT1_12_ FROM query WHERE __hibernate_row_nr__ >= ? AND __hibernate_row_nr__ < ?", + "with query as (select inner_query.*, row_number() over (order by current_timestamp) as __row__ " + + "from ( " + selectDistinctSubselectSQL + " ) inner_query ) " + + "select content1_12_ from query where __row__ >= ? and __row__ < ?", dialect.getLimitHandler().processSql( selectDistinctSubselectSQL, toRowSelection( 1, 5 ) ) ); } @@ -189,18 +189,18 @@ public class SQLServer2005DialectTestCase extends BaseUnitTestCase { @Test @TestForIssue(jiraKey = "HHH-6728") public void testGetLimitStringCaseSensitive() { - final String caseSensitiveSQL = "select persistent0_.id, persistent0_.uid AS tmp1, " + + final String caseSensitiveSQL = "select persistent0_.id, persistent0_.uid as tmp1, " + "(select case when persistent0_.name = 'Smith' then 'Neo' else persistent0_.id end) " + - "from C_Customer persistent0_ " + + "from c_customer persistent0_ " + "where persistent0_.type='Va' " + "order by persistent0_.Order"; assertEquals( - "WITH query AS (SELECT inner_query.*, ROW_NUMBER() OVER (ORDER BY CURRENT_TIMESTAMP) as __hibernate_row_nr__ FROM ( " + - "select TOP(?) persistent0_.id as page0_, persistent0_.uid AS tmp1, " + + "with query as (select inner_query.*, row_number() over (order by current_timestamp) as __row__ from ( " + + "select top(?) persistent0_.id as page0_, persistent0_.uid as tmp1, " + "(select case when persistent0_.name = 'Smith' then 'Neo' else persistent0_.id end) as page1_ " + - "from C_Customer persistent0_ where persistent0_.type='Va' order by persistent0_.Order ) " + - "inner_query ) SELECT page0_, tmp1, page1_ FROM query WHERE __hibernate_row_nr__ >= ? AND __hibernate_row_nr__ < ?", + "from c_customer persistent0_ where persistent0_.type='Va' order by persistent0_.Order ) " + + "inner_query ) select page0_, tmp1, page1_ from query where __row__ >= ? and __row__ < ?", dialect.getLimitHandler().processSql( caseSensitiveSQL, toRowSelection( 1, 2 ) ) ); } @@ -211,9 +211,9 @@ public class SQLServer2005DialectTestCase extends BaseUnitTestCase { final String distinctInAggregateSQL = "select aggregate_function(distinct p.n) as f1 from table849752 p order by f1"; assertEquals( - "WITH query AS (SELECT inner_query.*, ROW_NUMBER() OVER (ORDER BY CURRENT_TIMESTAMP) as __hibernate_row_nr__ FROM ( " + - "select TOP(?) aggregate_function(distinct p.n) as f1 from table849752 p order by f1 ) inner_query ) " + - "SELECT f1 FROM query WHERE __hibernate_row_nr__ >= ? AND __hibernate_row_nr__ < ?", + "with query as (select inner_query.*, row_number() over (order by current_timestamp) as __row__ from ( " + + "select top(?) aggregate_function(distinct p.n) as f1 from table849752 p order by f1 ) inner_query ) " + + "select f1 from query where __row__ >= ? and __row__ < ?", dialect.getLimitHandler().processSql( distinctInAggregateSQL, toRowSelection( 2, 5 ) ) ); } @@ -224,9 +224,9 @@ public class SQLServer2005DialectTestCase extends BaseUnitTestCase { final String distinctInAggregateSQL = "select aggregate_function(distinct p.n) from table849752 p order by f1"; assertEquals( - "WITH query AS (SELECT inner_query.*, ROW_NUMBER() OVER (ORDER BY CURRENT_TIMESTAMP) as __hibernate_row_nr__ FROM ( " + - "select TOP(?) aggregate_function(distinct p.n) as page0_ from table849752 p order by f1 ) inner_query ) " + - "SELECT page0_ FROM query WHERE __hibernate_row_nr__ >= ? AND __hibernate_row_nr__ < ?", + "with query as (select inner_query.*, row_number() over (order by current_timestamp) as __row__ from ( " + + "select top(?) aggregate_function(distinct p.n) as page0_ from table849752 p order by f1 ) inner_query ) " + + "select page0_ from query where __row__ >= ? and __row__ < ?", dialect.getLimitHandler().processSql( distinctInAggregateSQL, toRowSelection( 2, 5 ) ) ); } @@ -237,9 +237,9 @@ public class SQLServer2005DialectTestCase extends BaseUnitTestCase { final String distinctInAggregateSQL = "select aggregate_function(distinct p.n) f1 from table849752 p order by f1"; assertEquals( - "WITH query AS (SELECT inner_query.*, ROW_NUMBER() OVER (ORDER BY CURRENT_TIMESTAMP) as __hibernate_row_nr__ FROM ( " + - "select TOP(?) aggregate_function(distinct p.n) f1 from table849752 p order by f1 ) inner_query ) " + - "SELECT f1 FROM query WHERE __hibernate_row_nr__ >= ? AND __hibernate_row_nr__ < ?", + "with query as (select inner_query.*, row_number() over (order by current_timestamp) as __row__ from ( " + + "select top(?) aggregate_function(distinct p.n) f1 from table849752 p order by f1 ) inner_query ) " + + "select f1 from query where __row__ >= ? and __row__ < ?", dialect.getLimitHandler().processSql( distinctInAggregateSQL, toRowSelection( 2, 5 ) ) ); } @@ -248,20 +248,20 @@ public class SQLServer2005DialectTestCase extends BaseUnitTestCase { @TestForIssue(jiraKey = "HHH-7370") public void testGetLimitStringWithMaxOnly() { final String query = "select product2x0_.id as id0_, product2x0_.description as descript2_0_ " + - "from Product2 product2x0_ order by product2x0_.id"; + "from product2 product2x0_ order by product2x0_.id"; assertEquals( - "select TOP(?) product2x0_.id as id0_, product2x0_.description as descript2_0_ " + - "from Product2 product2x0_ order by product2x0_.id", + "select top(?) product2x0_.id as id0_, product2x0_.description as descript2_0_ " + + "from product2 product2x0_ order by product2x0_.id", dialect.getLimitHandler().processSql( query, toRowSelection( 0, 1 ) ) ); final String distinctQuery = "select distinct product2x0_.id as id0_, product2x0_.description as descript2_0_ " + - "from Product2 product2x0_ order by product2x0_.id"; + "from product2 product2x0_ order by product2x0_.id"; assertEquals( - "select distinct TOP(?) product2x0_.id as id0_, product2x0_.description as descript2_0_ " + - "from Product2 product2x0_ order by product2x0_.id", + "select distinct top(?) product2x0_.id as id0_, product2x0_.description as descript2_0_ " + + "from product2 product2x0_ order by product2x0_.id", dialect.getLimitHandler().processSql( distinctQuery, toRowSelection( 0, 5 ) ) ); } @@ -269,14 +269,14 @@ public class SQLServer2005DialectTestCase extends BaseUnitTestCase { @Test @TestForIssue(jiraKey = "HHH-7781") public void testGetLimitStringWithCastOperator() { - final String query = "select cast(lc302_doku6_.redniBrojStavke as varchar(255)) as col_0_0_, lc302_doku6_.dokumentiID as col_1_0_ " + - "from LC302_Dokumenti lc302_doku6_ order by lc302_doku6_.dokumentiID DESC"; + final String query = "select cast(lc302_doku6_.rednibrojstavke as varchar(255)) as col_0_0_, lc302_doku6_.dokumentiid as col_1_0_ " + + "from lc302_dokumenti lc302_doku6_ order by lc302_doku6_.dokumentiid desc"; assertEquals( - "WITH query AS (SELECT inner_query.*, ROW_NUMBER() OVER (ORDER BY CURRENT_TIMESTAMP) as __hibernate_row_nr__ FROM ( " + - "select TOP(?) cast(lc302_doku6_.redniBrojStavke as varchar(255)) as col_0_0_, lc302_doku6_.dokumentiID as col_1_0_ " + - "from LC302_Dokumenti lc302_doku6_ order by lc302_doku6_.dokumentiID DESC ) inner_query ) " + - "SELECT col_0_0_, col_1_0_ FROM query WHERE __hibernate_row_nr__ >= ? AND __hibernate_row_nr__ < ?", + "with query as (select inner_query.*, row_number() over (order by current_timestamp) as __row__ from ( " + + "select top(?) cast(lc302_doku6_.rednibrojstavke as varchar(255)) as col_0_0_, lc302_doku6_.dokumentiid as col_1_0_ " + + "from lc302_dokumenti lc302_doku6_ order by lc302_doku6_.dokumentiid desc ) inner_query ) " + + "select col_0_0_, col_1_0_ from query where __row__ >= ? and __row__ < ?", dialect.getLimitHandler().processSql( query, toRowSelection( 1, 3 ) ) ); } @@ -284,14 +284,14 @@ public class SQLServer2005DialectTestCase extends BaseUnitTestCase { @Test @TestForIssue(jiraKey = "HHH-10994") public void testGetLimitStringWithCastOperatorWithAliasNoAs() { - final String query = "select cast(lc302_doku6_.redniBrojStavke as varchar(255)) f1, lc302_doku6_.dokumentiID f2 " + - "from LC302_Dokumenti lc302_doku6_ order by lc302_doku6_.dokumentiID DESC"; + final String query = "select cast(lc302_doku6_.rednibrojstavke as varchar(255)) f1, lc302_doku6_.dokumentiid f2 " + + "from lc302_dokumenti lc302_doku6_ order by lc302_doku6_.dokumentiid desc"; assertEquals( - "WITH query AS (SELECT inner_query.*, ROW_NUMBER() OVER (ORDER BY CURRENT_TIMESTAMP) as __hibernate_row_nr__ FROM ( " + - "select TOP(?) cast(lc302_doku6_.redniBrojStavke as varchar(255)) f1, lc302_doku6_.dokumentiID f2 " + - "from LC302_Dokumenti lc302_doku6_ order by lc302_doku6_.dokumentiID DESC ) inner_query ) " + - "SELECT f1, f2 FROM query WHERE __hibernate_row_nr__ >= ? AND __hibernate_row_nr__ < ?", + "with query as (select inner_query.*, row_number() over (order by current_timestamp) as __row__ from ( " + + "select top(?) cast(lc302_doku6_.rednibrojstavke as varchar(255)) f1, lc302_doku6_.dokumentiid f2 " + + "from lc302_dokumenti lc302_doku6_ order by lc302_doku6_.dokumentiid desc ) inner_query ) " + + "select f1, f2 from query where __row__ >= ? and __row__ < ?", dialect.getLimitHandler().processSql( query, toRowSelection( 1, 3 ) ) ); } @@ -299,14 +299,14 @@ public class SQLServer2005DialectTestCase extends BaseUnitTestCase { @Test @TestForIssue(jiraKey = "HHH-10994") public void testGetLimitStringWithCastOperatorWithoutAliases() { - final String query = "select cast(lc302_doku6_.redniBrojStavke as varchar(255)), lc302_doku6_.dokumentiID " + - "from LC302_Dokumenti lc302_doku6_ order by lc302_doku6_.dokumentiID DESC"; + final String query = "select cast(lc302_doku6_.rednibrojstavke as varchar(255)), lc302_doku6_.dokumentiid " + + "from lc302_dokumenti lc302_doku6_ order by lc302_doku6_.dokumentiid desc"; assertEquals( - "WITH query AS (SELECT inner_query.*, ROW_NUMBER() OVER (ORDER BY CURRENT_TIMESTAMP) as __hibernate_row_nr__ FROM ( " + - "select TOP(?) cast(lc302_doku6_.redniBrojStavke as varchar(255)) as page0_, lc302_doku6_.dokumentiID as page1_ " + - "from LC302_Dokumenti lc302_doku6_ order by lc302_doku6_.dokumentiID DESC ) inner_query ) " + - "SELECT page0_, page1_ FROM query WHERE __hibernate_row_nr__ >= ? AND __hibernate_row_nr__ < ?", + "with query as (select inner_query.*, row_number() over (order by current_timestamp) as __row__ from ( " + + "select top(?) cast(lc302_doku6_.rednibrojstavke as varchar(255)) as page0_, lc302_doku6_.dokumentiid as page1_ " + + "from lc302_dokumenti lc302_doku6_ order by lc302_doku6_.dokumentiid desc ) inner_query ) " + + "select page0_, page1_ from query where __row__ >= ? and __row__ < ?", dialect.getLimitHandler().processSql( query, toRowSelection( 1, 3 ) ) ); } @@ -317,9 +317,9 @@ public class SQLServer2005DialectTestCase extends BaseUnitTestCase { final String query = "select t1.*, t2.* from tab1 t1, tab2 t2 where t1.ref = t2.ref order by t1.id desc"; assertEquals( - "WITH query AS (SELECT inner_query.*, ROW_NUMBER() OVER (ORDER BY CURRENT_TIMESTAMP) as __hibernate_row_nr__ FROM ( " + - "select TOP(?) t1.*, t2.* from tab1 t1, tab2 t2 where t1.ref = t2.ref order by t1.id desc ) inner_query ) " + - "SELECT * FROM query WHERE __hibernate_row_nr__ >= ? AND __hibernate_row_nr__ < ?", + "with query as (select inner_query.*, row_number() over (order by current_timestamp) as __row__ from ( " + + "select top(?) t1.*, t2.* from tab1 t1, tab2 t2 where t1.ref = t2.ref order by t1.id desc ) inner_query ) " + + "select * from query where __row__ >= ? and __row__ < ?", dialect.getLimitHandler().processSql( query, toRowSelection( 1, 3 ) ) ); } @@ -330,9 +330,9 @@ public class SQLServer2005DialectTestCase extends BaseUnitTestCase { final String query = "select * from tab1 t1, tab2 t2 where t1.ref = t2.ref order by t1.id desc"; assertEquals( - "WITH query AS (SELECT inner_query.*, ROW_NUMBER() OVER (ORDER BY CURRENT_TIMESTAMP) as __hibernate_row_nr__ FROM ( " + - "select TOP(?) * from tab1 t1, tab2 t2 where t1.ref = t2.ref order by t1.id desc ) inner_query ) " + - "SELECT * FROM query WHERE __hibernate_row_nr__ >= ? AND __hibernate_row_nr__ < ?", + "with query as (select inner_query.*, row_number() over (order by current_timestamp) as __row__ from ( " + + "select top(?) * from tab1 t1, tab2 t2 where t1.ref = t2.ref order by t1.id desc ) inner_query ) " + + "select * from query where __row__ >= ? and __row__ < ?", dialect.getLimitHandler().processSql( query, toRowSelection( 1, 3 ) ) ); } @@ -342,9 +342,9 @@ public class SQLServer2005DialectTestCase extends BaseUnitTestCase { public void testGetLimitStringWithFromInColumnName() { final String query = "select [Created From Nonstock Item], field2 from table1"; - assertEquals( "WITH query AS (SELECT inner_query.*, ROW_NUMBER() OVER (ORDER BY CURRENT_TIMESTAMP) as __hibernate_row_nr__ FROM ( " + + assertEquals( "with query as (select inner_query.*, row_number() over (order by current_timestamp) as __row__ from ( " + "select [Created From Nonstock Item] as page0_, field2 as page1_ from table1 ) inner_query ) " + - "SELECT page0_, page1_ FROM query WHERE __hibernate_row_nr__ >= ? AND __hibernate_row_nr__ < ?", + "select page0_, page1_ from query where __row__ >= ? and __row__ < ?", dialect.getLimitHandler().processSql( query, toRowSelection( 1, 5 ) ) ); } @@ -354,9 +354,9 @@ public class SQLServer2005DialectTestCase extends BaseUnitTestCase { public void testGetLimitStringWithQuotedColumnNamesAndAlias() { final String query = "select [Created From Item] c1, field2 from table1"; - assertEquals( "WITH query AS (SELECT inner_query.*, ROW_NUMBER() OVER (ORDER BY CURRENT_TIMESTAMP) as __hibernate_row_nr__ FROM ( " + + assertEquals( "with query as (select inner_query.*, row_number() over (order by current_timestamp) as __row__ from ( " + "select [Created From Item] c1, field2 as page0_ from table1 ) inner_query ) " + - "SELECT c1, page0_ FROM query WHERE __hibernate_row_nr__ >= ? AND __hibernate_row_nr__ < ?", + "select c1, page0_ from query where __row__ >= ? and __row__ < ?", dialect.getLimitHandler().processSql( query, toRowSelection( 1, 5 ) ) ); } @@ -366,9 +366,9 @@ public class SQLServer2005DialectTestCase extends BaseUnitTestCase { public void testGetLimitStringWithQuotedColumnNamesAndAliasWithAs() { final String query = "select [Created From Item] as c1, field2 from table1"; - assertEquals( "WITH query AS (SELECT inner_query.*, ROW_NUMBER() OVER (ORDER BY CURRENT_TIMESTAMP) as __hibernate_row_nr__ FROM ( " + + assertEquals( "with query as (select inner_query.*, row_number() over (order by current_timestamp) as __row__ from ( " + "select [Created From Item] as c1, field2 as page0_ from table1 ) inner_query ) " + - "SELECT c1, page0_ FROM query WHERE __hibernate_row_nr__ >= ? AND __hibernate_row_nr__ < ?", + "select c1, page0_ from query where __row__ >= ? and __row__ < ?", dialect.getLimitHandler().processSql( query, toRowSelection( 1, 5 ) ) ); } @@ -376,12 +376,12 @@ public class SQLServer2005DialectTestCase extends BaseUnitTestCase { @Test @TestForIssue(jiraKey = "HHH-11324") public void testGetLimitStringWithSelectClauseNestedQueryUsingParenthesis() { - final String query = "select t1.c1 as col_0_0, (select case when count(t2.c1)>0 then 'ADDED' else 'UNMODIFIED' end from table2 t2 WHERE (t2.c1 in (?))) as col_1_0 from table1 t1 WHERE 1=1 ORDER BY t1.c1 ASC"; + final String query = "select t1.c1 as col_0_0, (select case when count(t2.c1)>0 then 'added' else 'unmodified' end from table2 t2 where (t2.c1 in (?))) as col_1_0 from table1 t1 where 1=1 order by t1.c1 asc"; assertEquals( - "WITH query AS (SELECT inner_query.*, ROW_NUMBER() OVER (ORDER BY CURRENT_TIMESTAMP) as __hibernate_row_nr__ FROM ( " + - "select TOP(?) t1.c1 as col_0_0, (select case when count(t2.c1)>0 then 'ADDED' else 'UNMODIFIED' end from table2 t2 WHERE (t2.c1 in (?))) as col_1_0 from table1 t1 WHERE 1=1 ORDER BY t1.c1 ASC ) inner_query ) " + - "SELECT col_0_0, col_1_0 FROM query WHERE __hibernate_row_nr__ >= ? AND __hibernate_row_nr__ < ?", + "with query as (select inner_query.*, row_number() over (order by current_timestamp) as __row__ from ( " + + "select top(?) t1.c1 as col_0_0, (select case when count(t2.c1)>0 then 'added' else 'unmodified' end from table2 t2 where (t2.c1 in (?))) as col_1_0 from table1 t1 where 1=1 order by t1.c1 asc ) inner_query ) " + + "select col_0_0, col_1_0 from query where __row__ >= ? and __row__ < ?", dialect.getLimitHandler().processSql( query, toRowSelection( 1, 5 ) ) ); } @@ -389,11 +389,11 @@ public class SQLServer2005DialectTestCase extends BaseUnitTestCase { @Test @TestForIssue(jiraKey = "HHH-11650") public void testGetLimitWithStringValueContainingParenthesis() { - final String query = "select t1.c1 as col_0_0 FROM table1 t1 where t1.c1 = '(123' ORDER BY t1.c1 ASC"; + final String query = "select t1.c1 as col_0_0 from table1 t1 where t1.c1 = '(123' order by t1.c1 asc"; assertEquals( - "WITH query AS (SELECT inner_query.*, ROW_NUMBER() OVER (ORDER BY CURRENT_TIMESTAMP) as __hibernate_row_nr__ FROM ( " + - "select TOP(?) t1.c1 as col_0_0 FROM table1 t1 where t1.c1 = '(123' ORDER BY t1.c1 ASC ) inner_query ) SELECT col_0_0 FROM query WHERE __hibernate_row_nr__ >= ? AND __hibernate_row_nr__ < ?", + "with query as (select inner_query.*, row_number() over (order by current_timestamp) as __row__ from ( " + + "select top(?) t1.c1 as col_0_0 from table1 t1 where t1.c1 = '(123' order by t1.c1 asc ) inner_query ) select col_0_0 from query where __row__ >= ? and __row__ < ?", dialect.getLimitHandler().processSql( query, toRowSelection( 1, 5 ) ) ); } @@ -401,10 +401,10 @@ public class SQLServer2005DialectTestCase extends BaseUnitTestCase { @Test @TestForIssue(jiraKey = "HHH-11324") public void testGetLimitStringWithSelectClauseNestedQueryUsingParenthesisOnlyTop() { - final String query = "select t1.c1 as col_0_0, (select case when count(t2.c1)>0 then 'ADDED' else 'UNMODIFIED' end from table2 t2 WHERE (t2.c1 in (?))) as col_1_0 from table1 t1 WHERE 1=1 ORDER BY t1.c1 ASC"; + final String query = "select t1.c1 as col_0_0, (select case when count(t2.c1)>0 then 'ADDED' else 'UNMODIFIED' end from table2 t2 where (t2.c1 in (?))) as col_1_0 from table1 t1 where 1=1 order by t1.c1 asc"; assertEquals( - "select TOP(?) t1.c1 as col_0_0, (select case when count(t2.c1)>0 then 'ADDED' else 'UNMODIFIED' end from table2 t2 WHERE (t2.c1 in (?))) as col_1_0 from table1 t1 WHERE 1=1 ORDER BY t1.c1 ASC", + "select top(?) t1.c1 as col_0_0, (select case when count(t2.c1)>0 then 'ADDED' else 'UNMODIFIED' end from table2 t2 where (t2.c1 in (?))) as col_1_0 from table1 t1 where 1=1 order by t1.c1 asc", dialect.getLimitHandler().processSql( query, toRowSelection( 0, 5 ) ) ); } @@ -415,34 +415,34 @@ public class SQLServer2005DialectTestCase extends BaseUnitTestCase { RowSelection selection = toRowSelection( 0, 5 ); // test top-based CTE with single CTE query definition with no odd formatting - final String query1 = "WITH a (c1, c2) AS (SELECT c1, c2 FROM t) SELECT c1, c2 FROM a"; + final String query1 = "with a (c1, c2) as (select c1, c2 from t) select c1, c2 from a"; assertEquals( - "WITH a (c1, c2) AS (SELECT c1, c2 FROM t) SELECT TOP(?) c1, c2 FROM a", + "with a (c1, c2) as (select c1, c2 from t) select top(?) c1, c2 from a", dialect.getLimitHandler().processSql( query1, selection ) ); // test top-based CTE with single CTE query definition and various tab, newline spaces - final String query2 = " \n\tWITH a (c1\n\t,c2)\t\nAS (SELECT\n\tc1,c2 FROM t)\t\nSELECT c1, c2 FROM a"; + final String query2 = " \n\twith a (c1\n\t,c2)\t\nas (select\n\tc1,c2 from t)\t\nselect c1, c2 from a"; assertEquals( - " \n\tWITH a (c1\n\t,c2)\t\nAS (SELECT\n\tc1,c2 FROM t)\t\nSELECT TOP(?) c1, c2 FROM a", + " \n\twith a (c1\n\t,c2)\t\nas (select\n\tc1,c2 from t)\t\nselect top(?) c1, c2 from a", dialect.getLimitHandler().processSql( query2, selection ) ); // test top-based CTE with multiple CTE query definitions with no odd formatting - final String query3 = "WITH a (c1, c2) AS (SELECT c1, c2 FROM t1), b (b1, b2) AS (SELECT b1, b2 FROM t2) " + - "SELECT c1, c2, b1, b2 FROM t1, t2 WHERE t1.c1 = t2.b1"; + final String query3 = "with a (c1, c2) as (select c1, c2 from t1), b (b1, b2) as (select b1, b2 from t2) " + + "select c1, c2, b1, b2 from t1, t2 where t1.c1 = t2.b1"; assertEquals( - "WITH a (c1, c2) AS (SELECT c1, c2 FROM t1), b (b1, b2) AS (SELECT b1, b2 FROM t2) " + - "SELECT TOP(?) c1, c2, b1, b2 FROM t1, t2 WHERE t1.c1 = t2.b1", + "with a (c1, c2) as (select c1, c2 from t1), b (b1, b2) as (select b1, b2 from t2) " + + "select top(?) c1, c2, b1, b2 from t1, t2 where t1.c1 = t2.b1", dialect.getLimitHandler().processSql( query3, selection ) ); // test top-based CTE with multiple CTE query definitions and various tab, newline spaces - final String query4 = " \n\r\tWITH a (c1, c2) AS\n\r (SELECT c1, c2 FROM t1)\n\r, b (b1, b2)\tAS\t" + - "(SELECT b1, b2 FROM t2) SELECT c1, c2, b1, b2 FROM t1, t2 WHERE t1.c1 = t2.b1"; + final String query4 = " \n\r\twith a (c1, c2) as\n\r (select c1, c2 from t1)\n\r, b (b1, b2)\tas\t" + + "(select b1, b2 from t2) select c1, c2, b1, b2 from t1, t2 where t1.c1 = t2.b1"; assertEquals( - " \n\r\tWITH a (c1, c2) AS\n\r (SELECT c1, c2 FROM t1)\n\r, b (b1, b2)\tAS\t(SELECT b1, b2 FROM t2)" + - " SELECT TOP(?) c1, c2, b1, b2 FROM t1, t2 WHERE t1.c1 = t2.b1", + " \n\r\twith a (c1, c2) as\n\r (select c1, c2 from t1)\n\r, b (b1, b2)\tas\t(select b1, b2 from t2)" + + " select top(?) c1, c2, b1, b2 from t1, t2 where t1.c1 = t2.b1", dialect.getLimitHandler().processSql( query4, selection ) ); } @@ -453,44 +453,44 @@ public class SQLServer2005DialectTestCase extends BaseUnitTestCase { RowSelection selection = toRowSelection( 1, 5 ); // test non-top based CTE with single CTE query definition with no odd formatting - final String query1 = "WITH a (c1, c2) AS (SELECT c1, c2 FROM t) SELECT c1, c2 FROM a"; + final String query1 = "with a (c1, c2) as (select c1, c2 from t) select c1, c2 from a"; assertEquals( - "WITH a (c1, c2) AS (SELECT c1, c2 FROM t), query AS (SELECT inner_query.*, ROW_NUMBER() OVER " + - "(ORDER BY CURRENT_TIMESTAMP) as __hibernate_row_nr__ FROM ( SELECT c1 as page0_, c2 as page1_ " + - "FROM a ) inner_query ) SELECT page0_, page1_ FROM query WHERE __hibernate_row_nr__ >= ? " + - "AND __hibernate_row_nr__ < ?", + "with a (c1, c2) as (select c1, c2 from t), query as (select inner_query.*, row_number() over " + + "(order by current_timestamp) as __row__ from ( select c1 as page0_, c2 as page1_ " + + "from a ) inner_query ) select page0_, page1_ from query where __row__ >= ? " + + "and __row__ < ?", dialect.getLimitHandler().processSql( query1, selection ) ); // test non-top based CTE with single CTE query definition and various tab, newline spaces - final String query2 = " \n\tWITH a (c1\n\t,c2)\t\nAS (SELECT\n\tc1,c2 FROM t)\t\nSELECT c1, c2 FROM a"; + final String query2 = " \n\twith a (c1\n\t,c2)\t\nas (select\n\tc1,c2 from t)\t\nselect c1, c2 from a"; assertEquals( - " \n\tWITH a (c1\n\t,c2)\t\nAS (SELECT\n\tc1,c2 FROM t), query AS (SELECT inner_query.*, ROW_NUMBER()" + - " OVER (ORDER BY CURRENT_TIMESTAMP) as __hibernate_row_nr__ FROM ( \t\nSELECT c1 as page0_, c2 " + - "as page1_ FROM a ) inner_query ) SELECT page0_, page1_ FROM query WHERE __hibernate_row_nr__ >= " + - "? AND __hibernate_row_nr__ < ?", + " \n\twith a (c1\n\t,c2)\t\nas (select\n\tc1,c2 from t), query as (select inner_query.*, row_number()" + + " over (order by current_timestamp) as __row__ from ( \t\nselect c1 as page0_, c2 " + + "as page1_ from a ) inner_query ) select page0_, page1_ from query where __row__ >= " + + "? and __row__ < ?", dialect.getLimitHandler().processSql( query2, selection ) ); // test non-top based CTE with multiple CTE query definitions with no odd formatting - final String query3 = "WITH a (c1, c2) AS (SELECT c1, c2 FROM t1), b (b1, b2) AS (SELECT b1, b2 FROM t2) " + - " SELECT c1, c2, b1, b2 FROM t1, t2 WHERE t1.c1 = t2.b1"; + final String query3 = "with a (c1, c2) as (select c1, c2 from t1), b (b1, b2) as (select b1, b2 from t2) " + + " select c1, c2, b1, b2 from t1, t2 where t1.c1 = t2.b1"; assertEquals( - "WITH a (c1, c2) AS (SELECT c1, c2 FROM t1), b (b1, b2) AS (SELECT b1, b2 FROM t2), query AS (" + - "SELECT inner_query.*, ROW_NUMBER() OVER (ORDER BY CURRENT_TIMESTAMP) as __hibernate_row_nr__ FROM (" + - " SELECT c1 as page0_, c2 as page1_, b1 as page2_, b2 as page3_ FROM t1, t2 WHERE t1.c1 = t2.b1 ) inner_query )" + - " SELECT page0_, page1_, page2_, page3_ FROM query WHERE __hibernate_row_nr__ >= ? AND __hibernate_row_nr__ < ?", + "with a (c1, c2) as (select c1, c2 from t1), b (b1, b2) as (select b1, b2 from t2), query as (" + + "select inner_query.*, row_number() over (order by current_timestamp) as __row__ from (" + + " select c1 as page0_, c2 as page1_, b1 as page2_, b2 as page3_ from t1, t2 where t1.c1 = t2.b1 ) inner_query )" + + " select page0_, page1_, page2_, page3_ from query where __row__ >= ? and __row__ < ?", dialect.getLimitHandler().processSql( query3, selection ) ); // test top-based CTE with multiple CTE query definitions and various tab, newline spaces - final String query4 = " \n\r\tWITH a (c1, c2) AS\n\r (SELECT c1, c2 FROM t1)\n\r, b (b1, b2)\tAS\t(SELECT b1, " + - "b2 FROM t2) SELECT c1, c2, b1, b2 FROM t1, t2 WHERE t1.c1 = t2.b1"; + final String query4 = " \n\r\twith a (c1, c2) as\n\r (select c1, c2 from t1)\n\r, b (b1, b2)\tas\t(select b1, " + + "b2 from t2) select c1, c2, b1, b2 from t1, t2 where t1.c1 = t2.b1"; assertEquals( - " \n\r\tWITH a (c1, c2) AS\n\r (SELECT c1, c2 FROM t1)\n\r, b (b1, b2)\tAS\t(SELECT b1, b2 FROM t2), query AS (" + - "SELECT inner_query.*, ROW_NUMBER() OVER (ORDER BY CURRENT_TIMESTAMP) as __hibernate_row_nr__ FROM (" + - " SELECT c1 as page0_, c2 as page1_, b1 as page2_, b2 as page3_ FROM t1, t2 WHERE t1.c1 = t2.b1 ) inner_query )" + - " SELECT page0_, page1_, page2_, page3_ FROM query WHERE __hibernate_row_nr__ >= ? AND __hibernate_row_nr__ < ?", + " \n\r\twith a (c1, c2) as\n\r (select c1, c2 from t1)\n\r, b (b1, b2)\tas\t(select b1, b2 from t2), query as (" + + "select inner_query.*, row_number() over (order by current_timestamp) as __row__ from (" + + " select c1 as page0_, c2 as page1_, b1 as page2_, b2 as page3_ from t1, t2 where t1.c1 = t2.b1 ) inner_query )" + + " select page0_, page1_, page2_, page3_ from query where __row__ >= ? and __row__ < ?", dialect.getLimitHandler().processSql( query4, selection ) ); } diff --git a/hibernate-core/src/test/java/org/hibernate/dialect/SQLServer2012DialectTestCase.java b/hibernate-core/src/test/java/org/hibernate/dialect/SQLServer2012DialectTestCase.java index 468daf591f..88ec294feb 100644 --- a/hibernate-core/src/test/java/org/hibernate/dialect/SQLServer2012DialectTestCase.java +++ b/hibernate-core/src/test/java/org/hibernate/dialect/SQLServer2012DialectTestCase.java @@ -75,9 +75,9 @@ public class SQLServer2012DialectTestCase extends BaseUnitTestCase { // See SQLServer2012LimitHandler for why this falls back final String input = "select f1 from table"; assertEquals( - "with query as (select inner_query.*, row_number() over (order by current_timestamp) as __hibernate_row_nr__ " + + "with query as (select inner_query.*, row_number() over (order by current_timestamp) as __row__ " + "from ( select f1 as page0_ from table ) inner_query ) select page0_ from query where " + - "__hibernate_row_nr__ >= ? and __hibernate_row_nr__ < ?", + "__row__ >= ? and __row__ < ?", dialect.getLimitHandler().processSql( input, toRowSelection( 5, 10 ) ).toLowerCase( Locale.ROOT ) ); } diff --git a/hibernate-core/src/test/java/org/hibernate/jpa/test/query/NamedQueryCommentTest.java b/hibernate-core/src/test/java/org/hibernate/jpa/test/query/NamedQueryCommentTest.java index c0e07bcea0..163a78b223 100644 --- a/hibernate-core/src/test/java/org/hibernate/jpa/test/query/NamedQueryCommentTest.java +++ b/hibernate-core/src/test/java/org/hibernate/jpa/test/query/NamedQueryCommentTest.java @@ -207,7 +207,7 @@ public class NamedQueryCommentTest extends BaseEntityManagerFunctionalTestCase { sqlStatementInterceptor.assertExecutedCount(1); sqlStatementInterceptor.assertExecuted( - "/* COMMENT_SELECT_INDEX_game_title */ select namedquery0_.id as id1_0_, namedquery0_.title as title2_0_ from game namedquery0_ USE INDEX (idx_game_id) where namedquery0_.title=?" ) + "/* COMMENT_SELECT_INDEX_game_title */ select namedquery0_.id as id1_0_, namedquery0_.title as title2_0_ from game namedquery0_ use index (idx_game_id) where namedquery0_.title=?" ) ; } ); } From 2952b60cc33660c676efa7e55c7811e3431aa21b Mon Sep 17 00:00:00 2001 From: Andrea Boriero Date: Thu, 20 May 2021 16:17:19 +0200 Subject: [PATCH 02/16] HHH-14624 add test --- .../test/pagination/OraclePaginationTest.java | 155 ++++++----- .../OraclePaginationWithLocksTest.java | 253 ++++++++++++++++++ 2 files changed, 343 insertions(+), 65 deletions(-) create mode 100644 hibernate-core/src/test/java/org/hibernate/test/pagination/OraclePaginationWithLocksTest.java diff --git a/hibernate-core/src/test/java/org/hibernate/test/pagination/OraclePaginationTest.java b/hibernate-core/src/test/java/org/hibernate/test/pagination/OraclePaginationTest.java index fda480877b..8e4caf63c8 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/pagination/OraclePaginationTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/pagination/OraclePaginationTest.java @@ -16,6 +16,8 @@ import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase; import org.hibernate.testing.RequiresDialect; import org.hibernate.testing.TestForIssue; +import org.junit.After; +import org.junit.Before; import org.junit.Test; import static org.hibernate.testing.transaction.TransactionUtil.doInJPA; @@ -34,6 +36,94 @@ public class OraclePaginationTest extends BaseEntityManagerFunctionalTestCase { }; } + @Before + public void setUp() { + doInJPA( this::entityManagerFactory, entityManager -> { + entityManager.persist( new RootEntity( 1L, 7L, "t40", 2L ) ); + entityManager.persist( new RootEntity( 16L, 1L, "t47", 2L ) ); + entityManager.persist( new RootEntity( 11L, 2L, "t43", 2L ) ); + entityManager.persist( new RootEntity( 6L, 4L, "t31", 2L ) ); + entityManager.persist( new RootEntity( 15L, 1L, "t46", 2L ) ); + entityManager.persist( new RootEntity( 2L, 6L, "t39", 2L ) ); + entityManager.persist( new RootEntity( 14L, 1L, "t45", 2L ) ); + entityManager.persist( new RootEntity( 4L, 5L, "t38", 2L ) ); + entityManager.persist( new RootEntity( 8L, 2L, "t29", 2L ) ); + entityManager.persist( new RootEntity( 17L, 1L, "t48", 2L ) ); + entityManager.persist( new RootEntity( 3L, 3L, "t21", 2L ) ); + entityManager.persist( new RootEntity( 7L, 2L, "t23", 2L ) ); + entityManager.persist( new RootEntity( 9L, 2L, "t30", 2L ) ); + entityManager.persist( new RootEntity( 10L, 3L, "t42", 2L ) ); + entityManager.persist( new RootEntity( 12L, 1L, "t41", 2L ) ); + entityManager.persist( new RootEntity( 5L, 6L, "t37", 1L ) ); + entityManager.persist( new RootEntity( 13L, 1L, "t44", 1L ) ); + } ); + } + + @After + public void tearDown() { + doInJPA( this::entityManagerFactory, entityManager -> { + entityManager.createQuery( "delete from RootEntity" ).executeUpdate(); + } ); + } + + + @Test + @TestForIssue(jiraKey = "HHH-12087") + public void testPagination() { + doInJPA( this::entityManagerFactory, entityManager -> { + List rootEntitiesAllPages = getLimitedRows( entityManager, 0, 10 ); + + List rootEntitiesFirst = getLimitedRows( entityManager, 0, 5 ); + assertEquals( 5, rootEntitiesFirst.size() ); + List rootEntitiesSecond = getLimitedRows( entityManager, 5, 10 ); + assertEquals( 10, rootEntitiesSecond.size() ); + + assertEquals( rootEntitiesAllPages.get( 0 ).getId(), rootEntitiesFirst.get( 0 ).getId() ); + assertEquals( rootEntitiesAllPages.get( 1 ).getId(), rootEntitiesFirst.get( 1 ).getId() ); + assertEquals( rootEntitiesAllPages.get( 2 ).getId(), rootEntitiesFirst.get( 2 ).getId() ); + assertEquals( rootEntitiesAllPages.get( 3 ).getId(), rootEntitiesFirst.get( 3 ).getId() ); + assertEquals( rootEntitiesAllPages.get( 4 ).getId(), rootEntitiesFirst.get( 4 ).getId() ); + + assertEquals( rootEntitiesAllPages.get( 5 ).getId(), rootEntitiesSecond.get( 0 ).getId() ); + assertEquals( rootEntitiesAllPages.get( 6 ).getId(), rootEntitiesSecond.get( 1 ).getId() ); + assertEquals( rootEntitiesAllPages.get( 7 ).getId(), rootEntitiesSecond.get( 2 ).getId() ); + assertEquals( rootEntitiesAllPages.get( 8 ).getId(), rootEntitiesSecond.get( 3 ).getId() ); + assertEquals( rootEntitiesAllPages.get( 9 ).getId(), rootEntitiesSecond.get( 4 ).getId() ); + } ); + } + + @Test + public void testPaginationWithSetMaxResultsOnly() { + doInJPA( this::entityManagerFactory, entityManager -> { + CriteriaBuilder cb = entityManager.getCriteriaBuilder(); + CriteriaQuery cq = cb.createQuery( RootEntity.class ); + Root c = cq.from( RootEntity.class ); + CriteriaQuery select = cq.select( c ).orderBy( cb.desc( c.get( "status" ) ) ); + TypedQuery typedQuery = entityManager.createQuery( select ); + typedQuery.setMaxResults( 10 ); + List resultList = typedQuery.getResultList(); + assertEquals( 10, resultList.size() ); + } ); + } + + private List getAllRows(EntityManager em) { + CriteriaBuilder cb = em.getCriteriaBuilder(); + CriteriaQuery cq = cb.createQuery( RootEntity.class ); + Root c = cq.from( RootEntity.class ); + return em.createQuery( cq.select( c ).orderBy( cb.desc( c.get( "status" ) ) ) ).getResultList(); + } + + private List getLimitedRows(EntityManager em, int start, int end) { + CriteriaBuilder cb = em.getCriteriaBuilder(); + CriteriaQuery cq = cb.createQuery( RootEntity.class ); + Root c = cq.from( RootEntity.class ); + CriteriaQuery select = cq.select( c ).orderBy( cb.desc( c.get( "status" ) ) ); + TypedQuery typedQuery = em.createQuery( select ); + typedQuery.setFirstResult( start ); + typedQuery.setMaxResults( end ); + return typedQuery.getResultList(); + } + @Entity(name = "RootEntity") @Table(name = "V_MYTABLE_LAST") public static class RootEntity implements Serializable { @@ -63,69 +153,4 @@ public class OraclePaginationTest extends BaseEntityManagerFunctionalTestCase { } } - @Test - @TestForIssue(jiraKey = "HHH-12087") - public void testPagination() throws Exception { - - doInJPA( this::entityManagerFactory, entityManager -> { - entityManager.persist( new RootEntity( 1L, 7L, "t40", 2L ) ); - entityManager.persist( new RootEntity( 16L, 1L, "t47", 2L ) ); - entityManager.persist( new RootEntity( 11L, 2L, "t43", 2L ) ); - entityManager.persist( new RootEntity( 6L, 4L, "t31", 2L ) ); - entityManager.persist( new RootEntity( 15L, 1L, "t46", 2L ) ); - entityManager.persist( new RootEntity( 2L, 6L, "t39", 2L ) ); - entityManager.persist( new RootEntity( 14L, 1L, "t45", 2L ) ); - entityManager.persist( new RootEntity( 4L, 5L, "t38", 2L ) ); - entityManager.persist( new RootEntity( 8L, 2L, "t29", 2L ) ); - entityManager.persist( new RootEntity( 17L, 1L, "t48", 2L ) ); - entityManager.persist( new RootEntity( 3L, 3L, "t21", 2L ) ); - entityManager.persist( new RootEntity( 7L, 2L, "t23", 2L ) ); - entityManager.persist( new RootEntity( 9L, 2L, "t30", 2L ) ); - entityManager.persist( new RootEntity( 10L, 3L, "t42", 2L ) ); - entityManager.persist( new RootEntity( 12L, 1L, "t41", 2L ) ); - entityManager.persist( new RootEntity( 5L, 6L, "t37", 1L ) ); - entityManager.persist( new RootEntity( 13L, 1L, "t44", 1L ) ); - } ); - - doInJPA( this::entityManagerFactory, entityManager -> { - List rootEntitiesAllPages = getLimitedRows( entityManager, 0, 10 ); - - List rootEntitiesFirst = getLimitedRows( entityManager, 0, 5 ); - List rootEntitiesSecond = getLimitedRows( entityManager, 5, 10 ); - - assertEquals( rootEntitiesAllPages.get( 0 ).getId(), rootEntitiesFirst.get( 0 ).getId() ); - assertEquals( rootEntitiesAllPages.get( 1 ).getId(), rootEntitiesFirst.get( 1 ).getId() ); - assertEquals( rootEntitiesAllPages.get( 2 ).getId(), rootEntitiesFirst.get( 2 ).getId() ); - assertEquals( rootEntitiesAllPages.get( 3 ).getId(), rootEntitiesFirst.get( 3 ).getId() ); - assertEquals( rootEntitiesAllPages.get( 4 ).getId(), rootEntitiesFirst.get( 4 ).getId() ); - - assertEquals( rootEntitiesAllPages.get( 5 ).getId(), rootEntitiesSecond.get( 0 ).getId() ); - assertEquals( rootEntitiesAllPages.get( 6 ).getId(), rootEntitiesSecond.get( 1 ).getId() ); - assertEquals( rootEntitiesAllPages.get( 7 ).getId(), rootEntitiesSecond.get( 2 ).getId() ); - assertEquals( rootEntitiesAllPages.get( 8 ).getId(), rootEntitiesSecond.get( 3 ).getId() ); - assertEquals( rootEntitiesAllPages.get( 9 ).getId(), rootEntitiesSecond.get( 4 ).getId() ); - } ); - } - - private List getAllRows(EntityManager em) { - CriteriaBuilder cb = em.getCriteriaBuilder(); - CriteriaQuery cq = cb.createQuery( RootEntity.class ); - Root c = cq.from( RootEntity.class ); - return em.createQuery( cq.select( c ).orderBy( cb.desc( c.get( "status" ) ) ) ).getResultList(); - } - - private List getLimitedRows(EntityManager em, int start, int end) { - CriteriaBuilder cb = em.getCriteriaBuilder(); - CriteriaQuery cq = cb.createQuery( RootEntity.class ); - Root c = cq.from( RootEntity.class ); - CriteriaQuery select = cq.select( c ).orderBy( cb.desc( c.get( "status" ) ) ); - TypedQuery typedQuery = em.createQuery( select ); - typedQuery.setFirstResult( start ); - typedQuery.setMaxResults( end ); - return typedQuery.getResultList(); - } - - private void createRootEntity(EntityManager entityManager, Long id, Long version, String caption, String status) { - - } } diff --git a/hibernate-core/src/test/java/org/hibernate/test/pagination/OraclePaginationWithLocksTest.java b/hibernate-core/src/test/java/org/hibernate/test/pagination/OraclePaginationWithLocksTest.java new file mode 100644 index 0000000000..8aa64636ea --- /dev/null +++ b/hibernate-core/src/test/java/org/hibernate/test/pagination/OraclePaginationWithLocksTest.java @@ -0,0 +1,253 @@ +package org.hibernate.test.pagination; + +import java.util.List; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.criteria.CriteriaQuery; +import javax.persistence.criteria.Root; + +import org.hibernate.LockMode; +import org.hibernate.LockOptions; +import org.hibernate.cfg.Configuration; +import org.hibernate.cfg.Environment; +import org.hibernate.dialect.Oracle12cDialect; +import org.hibernate.resource.jdbc.spi.StatementInspector; + +import org.hibernate.testing.RequiresDialect; +import org.hibernate.testing.TestForIssue; +import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +@RequiresDialect(Oracle12cDialect.class) +@TestForIssue(jiraKey = "HHH-14624") +public class OraclePaginationWithLocksTest extends BaseCoreFunctionalTestCase { + private static final MostRecentStatementInspector mostRecentStatementInspector = new MostRecentStatementInspector(); + + @Override + protected Class[] getAnnotatedClasses() { + return new Class[] { Person.class }; + } + + @Override + protected void configure(Configuration configuration) { + super.configure( configuration ); + configuration.getProperties().put( Environment.STATEMENT_INSPECTOR, mostRecentStatementInspector ); + } + + @Before + public void setUp() { + inTransaction( + session -> { + for ( int i = 0; i < 20; i++ ) { + session.persist( new Person( "name" + i ) ); + } + session.persist( new Person( "for update" ) ); + } + ); + } + + @After + public void tearDown() { + inTransaction( + session -> + session.createQuery( "delete from Person" ).executeUpdate() + + ); + } + + @Test + public void testNativeQuery() { + inTransaction( + session -> { + final List people = session.createNativeQuery( "select * from Person for update" ) + .setMaxResults( 10 ) + .list(); + assertEquals( 10, people.size() ); + assertFalse( mostRecentStatementInspector.sqlContains( "fetch" ) ); + } + ); + + inTransaction( + session -> { + final List people = session.createNativeQuery( "select * from Person" ) + .setMaxResults( 10 ) + .list(); + assertEquals( 10, people.size() ); + assertTrue( mostRecentStatementInspector.sqlContains( "fetch" ) ); + } + ); + + inTransaction( + session -> { + final List people = session.createNativeQuery( "select * from Person" ) + .setFirstResult( 3 ) + .setMaxResults( 10 ) + .list(); + assertEquals( 10, people.size() ); + assertTrue( mostRecentStatementInspector.sqlContains( "fetch" ) ); + } + ); + } + + @Test + public void testCriteriaQuery() { + inTransaction( + session -> { + final CriteriaQuery query = session.getCriteriaBuilder().createQuery( Person.class ); + final Root root = query.from( Person.class ); + query.select( root ); + final List people = session.createQuery( query ) + .setMaxResults( 10 ) + .setLockOptions( new LockOptions( LockMode.PESSIMISTIC_WRITE ).setFollowOnLocking( false ) ) + .getResultList(); + assertEquals( 10, people.size() ); + assertFalse( mostRecentStatementInspector.sqlContains( "fetch" ) ); + } + ); + + inTransaction( + session -> { + final CriteriaQuery query = session.getCriteriaBuilder().createQuery( Person.class ); + final Root root = query.from( Person.class ); + query.select( root ); + final List people = session.createQuery( query ) + .setMaxResults( 10 ) + .getResultList(); + assertEquals( 10, people.size() ); + assertTrue( mostRecentStatementInspector.sqlContains( "fetch" ) ); + } + ); + + inTransaction( + session -> { + final CriteriaQuery query = session.getCriteriaBuilder().createQuery( Person.class ); + final Root root = query.from( Person.class ); + query.select( root ); + final List people = session.createQuery( query ) + .setMaxResults( 10 ) + .setFirstResult( 2 ) + .getResultList(); + assertEquals( 10, people.size() ); + assertTrue( mostRecentStatementInspector.sqlContains( "fetch" ) ); + } + ); + + } + + @Test + public void testHqlQuery() { + inTransaction( + session -> { + List people = session.createQuery( + "select p from Person p", Person.class ) + .setMaxResults( 10 ) + .setLockOptions( new LockOptions( LockMode.PESSIMISTIC_WRITE ).setFollowOnLocking( false ) ) + .getResultList(); + assertEquals( 10, people.size() ); + assertFalse( mostRecentStatementInspector.sqlContains( "fetch" ) ); + } + ); + + inTransaction( + session -> { + List people = session.createQuery( + "select p from Person p", Person.class ) + .setMaxResults( 10 ) + .getResultList(); + assertEquals( 10, people.size() ); + assertTrue( mostRecentStatementInspector.sqlContains( "fetch" ) ); + } + ); + + inTransaction( + session -> { + List people = session.createQuery( + "select p from Person p", Person.class ) + .setFirstResult( 2 ) + .setMaxResults( 10 ) + .getResultList(); + assertEquals( 10, people.size() ); + assertEquals( 10, people.size() ); + assertTrue( mostRecentStatementInspector.sqlContains( "fetch" ) ); + } + ); + + inTransaction( + session -> { + List people = session.createQuery( + "select p from Person p where p.name = 'for update'", Person.class ) + .setMaxResults( 10 ) + .setLockOptions( new LockOptions( LockMode.PESSIMISTIC_WRITE ).setFollowOnLocking( false ) ) + .getResultList(); + assertEquals( 1, people.size() ); + assertFalse( mostRecentStatementInspector.sqlContains( "fetch" ) ); + } + ); + + inTransaction( + session -> { + List people = session.createQuery( + "select p from Person p where p.name = 'for update'", Person.class ) + .setMaxResults( 10 ) + .getResultList(); + assertEquals( 1, people.size() ); + assertTrue( mostRecentStatementInspector.sqlContains( "fetch" ) ); + } + ); + + + } + + private static class MostRecentStatementInspector implements StatementInspector { + private String mostRecentSql; + + public String inspect(String sql) { + mostRecentSql = sql; + return sql; + } + + public boolean sqlContains(String toCheck) { + return mostRecentSql.contains( toCheck ); + } + + } + + @Entity(name = "Person") + public static class Person { + @Id + @GeneratedValue + private Long id; + + private String name; + + public Person() { + } + + public Person(String name) { + this.name = name; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + } +} From 422b80b80d5d87c1c70a00f5c83609a9c4eaca1a Mon Sep 17 00:00:00 2001 From: Andrea Boriero Date: Thu, 20 May 2021 16:18:07 +0200 Subject: [PATCH 03/16] HHH-14624 Oracle from version 12 started supporting the syntax for pagination --- .../hibernate/dialect/Oracle12cDialect.java | 10 + .../dialect/pagination/LimitHandler.java | 15 +- .../pagination/Oracle12LimitHandler.java | 181 ++++++++++++++++++ .../java/org/hibernate/loader/Loader.java | 2 +- .../internal/AbstractLoadPlanBasedLoader.java | 2 +- 5 files changed, 207 insertions(+), 3 deletions(-) create mode 100644 hibernate-core/src/main/java/org/hibernate/dialect/pagination/Oracle12LimitHandler.java diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/Oracle12cDialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/Oracle12cDialect.java index 941159b4b4..e184c65e0c 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/Oracle12cDialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/Oracle12cDialect.java @@ -10,6 +10,9 @@ import org.hibernate.boot.model.TypeContributions; import org.hibernate.cfg.Environment; import org.hibernate.dialect.identity.IdentityColumnSupport; import org.hibernate.dialect.identity.Oracle12cIdentityColumnSupport; +import org.hibernate.dialect.pagination.AbstractLimitHandler; +import org.hibernate.dialect.pagination.LimitHandler; +import org.hibernate.dialect.pagination.Oracle12LimitHandler; import org.hibernate.engine.config.spi.ConfigurationService; import org.hibernate.engine.config.spi.StandardConverters; import org.hibernate.service.ServiceRegistry; @@ -24,6 +27,8 @@ import org.hibernate.type.WrappedMaterializedBlobType; public class Oracle12cDialect extends Oracle10gDialect { public static final String PREFER_LONG_RAW = "hibernate.dialect.oracle.prefer_long_raw"; + private static final AbstractLimitHandler LIMIT_HANDLER = Oracle12LimitHandler.INSTANCE; + public Oracle12cDialect() { super(); getDefaultProperties().setProperty( Environment.BATCH_VERSIONED_DATA, "true" ); @@ -62,4 +67,9 @@ public class Oracle12cDialect extends Oracle10gDialect { public IdentityColumnSupport getIdentityColumnSupport() { return new Oracle12cIdentityColumnSupport(); } + + @Override + public LimitHandler getLimitHandler() { + return LIMIT_HANDLER; + } } diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/pagination/LimitHandler.java b/hibernate-core/src/main/java/org/hibernate/dialect/pagination/LimitHandler.java index 3013254bee..d0642b2277 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/pagination/LimitHandler.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/pagination/LimitHandler.java @@ -9,6 +9,7 @@ package org.hibernate.dialect.pagination; import java.sql.PreparedStatement; import java.sql.SQLException; +import org.hibernate.engine.spi.QueryParameters; import org.hibernate.engine.spi.RowSelection; /** @@ -37,13 +38,25 @@ public interface LimitHandler { /** * Return processed SQL query. * - * @param sql the SQL query to process. + * @param sql the SQL query to process. * @param selection the selection criteria for rows. * * @return Query statement with LIMIT clause applied. */ String processSql(String sql, RowSelection selection); + /** + * Return processed SQL query. + * + * @param sql the SQL query to process. + * @param queryParameters the queryParameters. + * + * @return Query statement with LIMIT clause applied. + */ + default String processSql(String sql, QueryParameters queryParameters ){ + return processSql( sql, queryParameters.getRowSelection() ); + } + /** * Bind parameter values needed by the LIMIT clause before original SELECT statement. * diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/pagination/Oracle12LimitHandler.java b/hibernate-core/src/main/java/org/hibernate/dialect/pagination/Oracle12LimitHandler.java new file mode 100644 index 0000000000..3067a01a81 --- /dev/null +++ b/hibernate-core/src/main/java/org/hibernate/dialect/pagination/Oracle12LimitHandler.java @@ -0,0 +1,181 @@ +/* + * Hibernate, Relational Persistence for Idiomatic Java + * + * License: GNU Lesser General Public License (LGPL), version 2.1 or later. + * See the lgpl.txt file in the root directory or . + */ +package org.hibernate.dialect.pagination; + +import java.util.Locale; + +import org.hibernate.LockMode; +import org.hibernate.LockOptions; +import org.hibernate.engine.spi.QueryParameters; +import org.hibernate.engine.spi.RowSelection; + +/** + * A {@link LimitHandler} for databases which support the + * ANSI SQL standard syntax {@code FETCH FIRST m ROWS ONLY} + * and {@code OFFSET n ROWS FETCH NEXT m ROWS ONLY}. + * + * @author Gavin King + */ +public class Oracle12LimitHandler extends AbstractLimitHandler { + + public boolean bindLimitParametersInReverseOrder; + public boolean useMaxForLimit; + + public static final Oracle12LimitHandler INSTANCE = new Oracle12LimitHandler(); + + Oracle12LimitHandler() { + } + + @Override + public String processSql(String sql, RowSelection selection) { + final boolean hasFirstRow = LimitHelper.hasFirstRow( selection ); + final boolean hasMaxRows = LimitHelper.hasMaxRows( selection ); + + if ( !hasMaxRows ) { + return sql; + } + + return processSql( sql, getForUpdateIndex( sql ), hasFirstRow ); + } + + @Override + public String processSql(String sql, QueryParameters queryParameters) { + final RowSelection selection = queryParameters.getRowSelection(); + + final boolean hasFirstRow = LimitHelper.hasFirstRow( selection ); + final boolean hasMaxRows = LimitHelper.hasMaxRows( selection ); + + if ( !hasMaxRows ) { + return sql; + } + + final LockOptions lockOptions = queryParameters.getLockOptions(); + if ( lockOptions != null ) { + final LockMode lockMode = lockOptions.getLockMode(); + switch ( lockMode ) { + case UPGRADE: + case PESSIMISTIC_READ: + case PESSIMISTIC_WRITE: + case UPGRADE_NOWAIT: + case FORCE: + case PESSIMISTIC_FORCE_INCREMENT: + case UPGRADE_SKIPLOCKED: + return processSql( sql, selection ); + default: + return processSqlOffsetFetch( sql, hasFirstRow ); + } + } + return processSqlOffsetFetch( sql, hasFirstRow ); + } + + private String processSqlOffsetFetch(String sql, boolean hasFirstRow) { + + final int forUpdateLastIndex = getForUpdateIndex( sql ); + + if ( forUpdateLastIndex > -1 ) { + return processSql( sql, forUpdateLastIndex, hasFirstRow ); + } + + bindLimitParametersInReverseOrder = false; + useMaxForLimit = false; + + sql = normalizeStatement( sql ); + final int offsetFetchLength; + final String offsetFetchString; + if ( hasFirstRow ) { + offsetFetchString = " offset ? rows fetch next ? rows only"; + } + else { + offsetFetchString = " fetch first ? rows only"; + } + offsetFetchLength = sql.length() + offsetFetchString.length(); + + return new StringBuilder( offsetFetchLength ).append( sql ).append( offsetFetchString ).toString(); + } + + private String processSql(String sql, int forUpdateIndex, boolean hasFirstRow) { + bindLimitParametersInReverseOrder = true; + useMaxForLimit = true; + sql = normalizeStatement( sql ); + + String forUpdateClause = null; + boolean isForUpdate = false; + if ( forUpdateIndex > -1 ) { + // save 'for update ...' and then remove it + forUpdateClause = sql.substring( forUpdateIndex ); + sql = sql.substring( 0, forUpdateIndex - 1 ); + isForUpdate = true; + } + + final StringBuilder pagingSelect; + + final int forUpdateClauseLength; + if ( forUpdateClause == null ) { + forUpdateClauseLength = 0; + } + else { + forUpdateClauseLength = forUpdateClause.length() + 1; + } + + if ( hasFirstRow ) { + pagingSelect = new StringBuilder( sql.length() + forUpdateClauseLength + 98 ); + pagingSelect.append( "select * from ( select row_.*, rownum rownum_ from ( " ); + pagingSelect.append( sql ); + pagingSelect.append( " ) row_ where rownum <= ?) where rownum_ > ?" ); + } + else { + pagingSelect = new StringBuilder( sql.length() + forUpdateClauseLength + 37 ); + pagingSelect.append( "select * from ( " ); + pagingSelect.append( sql ); + pagingSelect.append( " ) where rownum <= ?" ); + } + + if ( isForUpdate ) { + pagingSelect.append( " " ); + pagingSelect.append( forUpdateClause ); + } + + return pagingSelect.toString(); + } + + private String normalizeStatement(String sql) { + return sql.trim().replaceAll( "\\s+", " " ); + } + + private int getForUpdateIndex(String sql) { + final int forUpdateLastIndex = sql.toLowerCase( Locale.ROOT ).lastIndexOf( "for update" ); + // We need to recognize cases like : select a from t where b = 'for update'; + final int lastIndexOfQuote = sql.lastIndexOf( "'" ); + if ( forUpdateLastIndex > -1 ) { + if ( lastIndexOfQuote == -1 ) { + return forUpdateLastIndex; + } + if ( lastIndexOfQuote > forUpdateLastIndex ) { + return -1; + } + return forUpdateLastIndex; + } + return forUpdateLastIndex; + } + + @Override + public final boolean supportsLimit() { + return true; + } + + @Override + public boolean bindLimitParametersInReverseOrder() { + return bindLimitParametersInReverseOrder; + } + + @Override + public boolean useMaxForLimit() { + return useMaxForLimit; + } + + +} diff --git a/hibernate-core/src/main/java/org/hibernate/loader/Loader.java b/hibernate-core/src/main/java/org/hibernate/loader/Loader.java index db8e0e2fbe..5b8d2b87ed 100644 --- a/hibernate-core/src/main/java/org/hibernate/loader/Loader.java +++ b/hibernate-core/src/main/java/org/hibernate/loader/Loader.java @@ -2021,7 +2021,7 @@ public abstract class Loader { final LimitHandler limitHandler = getLimitHandler( queryParameters.getRowSelection() ); - String sql = limitHandler.processSql( queryParameters.getFilteredSQL(), queryParameters.getRowSelection() ); + String sql = limitHandler.processSql( queryParameters.getFilteredSQL(), queryParameters ); // Adding locks and comments. sql = preprocessSQL( sql, queryParameters, getFactory(), afterLoadActions ); diff --git a/hibernate-core/src/main/java/org/hibernate/loader/plan/exec/internal/AbstractLoadPlanBasedLoader.java b/hibernate-core/src/main/java/org/hibernate/loader/plan/exec/internal/AbstractLoadPlanBasedLoader.java index eb320df4c7..ba906058aa 100644 --- a/hibernate-core/src/main/java/org/hibernate/loader/plan/exec/internal/AbstractLoadPlanBasedLoader.java +++ b/hibernate-core/src/main/java/org/hibernate/loader/plan/exec/internal/AbstractLoadPlanBasedLoader.java @@ -149,7 +149,7 @@ public abstract class AbstractLoadPlanBasedLoader { final LimitHandler limitHandler = getLimitHandler( queryParameters.getRowSelection() ); - String sql = limitHandler.processSql( queryParameters.getFilteredSQL(), queryParameters.getRowSelection() ); + String sql = limitHandler.processSql( queryParameters.getFilteredSQL(), queryParameters ); // Adding locks and comments. sql = session.getJdbcServices().getJdbcEnvironment().getDialect() From fab2503981205a4bc9b381ab81fc11ddfb4dce11 Mon Sep 17 00:00:00 2001 From: Christian Beikov Date: Tue, 1 Jun 2021 16:33:02 +0200 Subject: [PATCH 04/16] Update Jakarta XML Binding API to 3.0.1 --- gradle/libraries.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libraries.gradle b/gradle/libraries.gradle index bbc3df82aa..1af583bc6c 100644 --- a/gradle/libraries.gradle +++ b/gradle/libraries.gradle @@ -87,7 +87,7 @@ ext { jakarta_interceptor: 'jakarta.interceptor:jakarta.interceptor-api:2.0.0', jakarta_activation: 'jakarta.activation:jakarta.activation-api:2.0.1', jakarta_resource: 'jakarta.resource:jakarta.resource-api:2.0.0', - jakarta_jaxb_api: 'jakarta.xml.bind:jakarta.xml.bind-api:3.0.0', + jakarta_jaxb_api: 'jakarta.xml.bind:jakarta.xml.bind-api:3.0.1', jakarta_jaxb_runtime: "org.glassfish.jaxb:jaxb-runtime:${jakartaJaxbRuntimeVersion}", jakarta_cdi: 'jakarta.enterprise:jakarta.enterprise.cdi-api:3.0.0', From 7a584223f81c61e872bafedebf3706f731fc2afe Mon Sep 17 00:00:00 2001 From: Hibernate-CI Date: Tue, 1 Jun 2021 14:56:34 +0000 Subject: [PATCH 05/16] 5.5.0.Final --- changelog.txt | 17 +++++++++++++++++ gradle/version.properties | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/changelog.txt b/changelog.txt index 45a2b4052b..7032ce85a2 100644 --- a/changelog.txt +++ b/changelog.txt @@ -3,6 +3,23 @@ Hibernate 5 Changelog Note: Please refer to JIRA to learn more about each issue. +Changes in 5.5.0.Final (June 01, 2021) +------------------------------------------------------------------------------------------------------------------------ + +https://hibernate.atlassian.net/projects/HHH/versions/31946 + +** Bug + * [HHH-14139] - BasicBinder Trace Logging Causes Duplicated Message + +** Improvement + * [HHH-14632] - Call statistics.queryPlanCacheHit and statistics.queryPlanCacheMiss for FilterQueryPlan and NativeSQLQueryPlan + * [HHH-14624] - Oracle from version 12 started supporting the `offset ? rows fetch next ? rows only`syntax for pagination + * [HHH-14240] - Stop generating fragments of SQL as uppercase + +** Task + * [HHH-14635] - Upgrade to latest JUnit and to Log4j 2 + + Changes in 5.5.0.CR1 (May 24, 2021) ------------------------------------------------------------------------------------------------------------------------ diff --git a/gradle/version.properties b/gradle/version.properties index 27307e6e59..489815b34c 100644 --- a/gradle/version.properties +++ b/gradle/version.properties @@ -1 +1 @@ -hibernateVersion=5.5.0-SNAPSHOT \ No newline at end of file +hibernateVersion=5.5.0.Final \ No newline at end of file From bf48b81422b1913c9802517803b7348217135a1e Mon Sep 17 00:00:00 2001 From: Hibernate-CI Date: Tue, 1 Jun 2021 15:02:43 +0000 Subject: [PATCH 06/16] 5.5.1-SNAPSHOT --- gradle/version.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/version.properties b/gradle/version.properties index 489815b34c..d5d6d7f95f 100644 --- a/gradle/version.properties +++ b/gradle/version.properties @@ -1 +1 @@ -hibernateVersion=5.5.0.Final \ No newline at end of file +hibernateVersion=5.5.1-SNAPSHOT \ No newline at end of file From 828afd348d2f3c2b9753bef686b19c98e4f37deb Mon Sep 17 00:00:00 2001 From: Christian Beikov Date: Wed, 2 Jun 2021 12:12:16 +0200 Subject: [PATCH 07/16] Parameterize Jenkins TCK pipelines and upload Jakarta JPA TCK results --- ci/jpa-2.2-tck.Jenkinsfile | 14 ++++++--- ci/jpa-3.0-tck.Jenkinsfile | 19 +++++++++---- tck/summary.md | 58 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 82 insertions(+), 9 deletions(-) create mode 100644 tck/summary.md diff --git a/ci/jpa-2.2-tck.Jenkinsfile b/ci/jpa-2.2-tck.Jenkinsfile index 87e9aa7bab..396536f53c 100644 --- a/ci/jpa-2.2-tck.Jenkinsfile +++ b/ci/jpa-2.2-tck.Jenkinsfile @@ -7,6 +7,9 @@ pipeline { tools { jdk 'OpenJDK 8 Latest' } + parameters { + booleanParam(name: 'NO_SLEEP', defaultValue: true, description: 'Whether the NO_SLEEP patch should be applied to speed up the TCK execution') + } stages { stage('Build') { steps { @@ -39,18 +42,21 @@ pipeline { steps { sh """ \ docker rm -f tck || true - docker run -v ~/.m2/repository/org/hibernate:/root/.m2/repository/org/hibernate:z -e NO_SLEEP=true -e HIBERNATE_VERSION=$HIBERNATE_VERSION --name tck jakarta-tck-runner - docker cp tck:/tck/persistence-tck/tmp/JTreport/ ./JTreport + docker rm -f tck-vol || true + docker volume create tck-vol + docker run -v ~/.m2/repository/org/hibernate:/root/.m2/repository/org/hibernate:z -v tck-vol:/tck/persistence-tck/tmp/:z -e NO_SLEEP=${params.NO_SLEEP} -e HIBERNATE_VERSION=$HIBERNATE_VERSION --name tck jakarta-tck-runner + docker cp tck:/tck/persistence-tck/tmp/ ./results """ - archiveArtifacts artifacts: 'JTreport/**' + archiveArtifacts artifacts: 'results/**' script { failures = sh ( script: """ \ + set +x while read line; do if [[ "\$line" != *"Passed." ]]; then echo "\$line" fi - done Date: Wed, 2 Jun 2021 15:44:15 +0100 Subject: [PATCH 08/16] HHH-14646 Updating the migration guide for 5.5 --- migration-guide.adoc | 40 ++++++++++++++-------------------------- 1 file changed, 14 insertions(+), 26 deletions(-) diff --git a/migration-guide.adoc b/migration-guide.adoc index 1614b2d284..e2700b165e 100644 --- a/migration-guide.adoc +++ b/migration-guide.adoc @@ -1,7 +1,7 @@ -= 5.4 Migration Guide += 5.5 Migration Guide :toc: -This guide discusses migration from Hibernate ORM version 5.3 to version 5.4. For migration from +This guide discusses migration from Hibernate ORM version 5.4 to version 5.5. For migration from earlier versions, see any other pertinent migration guides as well. == Background @@ -9,33 +9,21 @@ earlier versions, see any other pertinent migration guides as well. == Known changes -=== Overriding Delayed Identity Insert Behavior +This version is very similar to Hibernate ORM 5.4; essentially it includes all bugfixes that have been +applied to the 5.4 maintenance releases, and on top of this it introduces support for the Jakarta Persistence +API (in addition the the JPA APIs we already support). -In Hibernate 5.3, we added support for `DelayedPostInsertIdentifier` behavior to be influenced based on the -`FlushMode` or `FlushModeType` values, in short enhancing Extended PersistenceContext support. Unfortunately, -there were a few side effects that were recently reported with this change. -In Hibernate 5.4, we wanted to preserve as much of the 5.3 behavior as possible and only restore very specific -`DelayedPostInsertIdentifier` behavior for selected use cases. +=== Dom4J based XML mapping -We understand mappings can be complex and there very well could be a corner case we didn't consider. In order -to make 5.4 as flexible with these changes as possible, we added a configuration option that you can use as a -_temporary_ solution to completely disable the 5.3 behavior, reverting it back to 5.2 and prior. +The implementation of Hibernate's parsing of XML mapping definitions has been entirely reimplemented based on +JAXB rather than DOM4J, making progress to remove this ancient dependency. +No specific issues are known at this time. -`hibernate.id.disable_delayed_identity_inserts=true` +=== Removed the ability to disable "enhanced proxies" -If you find you need to use this configuration setting, be sure to report the mapping to us in a JIRA issue so -that we can review it and determine if the mapping corner case should be included in our algorithm since the -configuration setting is meant to bridge behavior support for this across a few releases. +The "enhanced proxies" feature has been introduced as a performance improving feature in 5.3 initially, at +which time it was optional. -=== Hibernate Spatial depends on JTS 1.16 - -Hibernate Spatial depends on the https://github.com/locationtech/jts[Java Topology Suite (JTS)]. In 5.4 this - dependency has been upgraded to version 1.16. This implies a change in package naming: - all `com.vividsolutions.jts.\*` packages have been renamed to `org.locationtech.jts.*`. - -See https://github.com/locationtech/jts/blob/master/MIGRATION.md[the JTS Migration guide] for more information. - -=== SQL Server JDBC Driver version upgrade to at least 6.1.2 - -Due to fixing https://hibernate.atlassian.net/browse/HHH-12973[HHH-12973], you need to upgrade the JDBC Driver version to at least 6.1.2. Due to https://github.com/Microsoft/mssql-jdbc/issues/91[this bug], the older versions of the SQL Server JDBC Driver cannot introspect the `INFORMATION_SCHEMA.SEQUENCES` without closing the database connection. +Since then, many more corner cases have been fixed and this feature is now always enabled. Enjoy the improvements! +No changes are expected to be needed in user code to benefit from this. From c490e86fccdd357c5ddc4182ea5e4e8691fa5c95 Mon Sep 17 00:00:00 2001 From: Christian Beikov Date: Wed, 2 Jun 2021 19:24:10 +0200 Subject: [PATCH 09/16] Fix issues with JPA 3.0 TCK run with alternative base image --- ci/jpa-3.0-tck.Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/jpa-3.0-tck.Jenkinsfile b/ci/jpa-3.0-tck.Jenkinsfile index 415e17f27c..03ea505159 100644 --- a/ci/jpa-3.0-tck.Jenkinsfile +++ b/ci/jpa-3.0-tck.Jenkinsfile @@ -8,7 +8,7 @@ pipeline { jdk 'OpenJDK 8 Latest' } parameters { - string(name: 'BASE_IMAGE', defaultValue: 'openjdk:8-jdk', description: 'The JDK base image to use for the image i.e. `openjdk:11-jdk`') + choice(name: 'IMAGE_JDK', choices: ['jdk8', 'jdk11'], description: 'The JDK base image version to use for the TCK image.') string(name: 'TCK_VERSION', defaultValue: '3.0.0', description: 'The version of the Jakarta JPA TCK i.e. `2.2.0` or `3.0.1`') string(name: 'TCK_SHA', defaultValue: 'b08c8887f00306f8bb7ebe54c4c810f3452519f5395733637ccc639b5081aebf', description: 'The SHA256 of the Jakarta JPA TCK that is distributed under https://download.eclipse.org/jakartaee/persistence/3.0/jakarta-persistence-tck-${TCK_VERSION}.zip.sha256') booleanParam(name: 'NO_SLEEP', defaultValue: true, description: 'Whether the NO_SLEEP patch should be applied to speed up the TCK execution') @@ -36,7 +36,7 @@ pipeline { dir('tck') { checkout changelog: false, poll: false, scm: [$class: 'GitSCM', branches: [[name: '*/main']], extensions: [], userRemoteConfigs: [[url: 'https://github.com/hibernate/jakarta-tck-runner.git']]] sh """ \ - cd jpa-3.0; docker build -t jakarta-tck-runner --build-arg JDK_IMAGE=${params.BASE_IMAGE} --build-arg TCK_VERSION=${params.TCK_VERSION} --build-arg TCK_SHA=${params.TCK_SHA} . + cd jpa-3.0; docker build -f Dockerfile.${params.IMAGE_JDK} -t jakarta-tck-runner --build-arg JDK_IMAGE=${params.BASE_IMAGE} --build-arg TCK_VERSION=${params.TCK_VERSION} --build-arg TCK_SHA=${params.TCK_SHA} . """ } } From df48d19bbc370f89b5aa0915640b9bc6c3e77a43 Mon Sep 17 00:00:00 2001 From: Sanne Grinovero Date: Wed, 2 Jun 2021 16:50:03 +0100 Subject: [PATCH 10/16] HHH-14647 Make ResourceRegistryStandardImpl#unassociatedResultSets lazily initialized --- .../jdbc/internal/ResourceRegistryStandardImpl.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/resource/jdbc/internal/ResourceRegistryStandardImpl.java b/hibernate-core/src/main/java/org/hibernate/resource/jdbc/internal/ResourceRegistryStandardImpl.java index 5c31b2f014..f8dbe76362 100644 --- a/hibernate-core/src/main/java/org/hibernate/resource/jdbc/internal/ResourceRegistryStandardImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/resource/jdbc/internal/ResourceRegistryStandardImpl.java @@ -52,7 +52,7 @@ public final class ResourceRegistryStandardImpl implements ResourceRegistry { private final JdbcObserver jdbcObserver; private final HashMap> xref = new HashMap<>(); - private final HashMap unassociatedResultSets = new HashMap(); + private HashMap unassociatedResultSets; private ArrayList blobs; private ArrayList clobs; @@ -138,7 +138,7 @@ public final class ResourceRegistryStandardImpl implements ResourceRegistry { } } else { - final Object removed = unassociatedResultSets.remove( resultSet ); + final Object removed = unassociatedResultSets == null ? null : unassociatedResultSets.remove( resultSet ); if ( removed == null ) { log.unregisteredResultSetWithoutStatement(); } @@ -147,6 +147,9 @@ public final class ResourceRegistryStandardImpl implements ResourceRegistry { } private static void closeAll(final HashMap resultSets) { + if ( resultSets == null ) { + return; + } resultSets.forEach( (resultSet, o) -> close( resultSet ) ); resultSets.clear(); } @@ -234,6 +237,9 @@ public final class ResourceRegistryStandardImpl implements ResourceRegistry { resultSets.put( resultSet, PRESENT ); } else { + if ( unassociatedResultSets == null ) { + this.unassociatedResultSets = new HashMap(); + } unassociatedResultSets.put( resultSet, PRESENT ); } } From c22393d57b1368414b35265f881619bcdf81726f Mon Sep 17 00:00:00 2001 From: Sanne Grinovero Date: Wed, 2 Jun 2021 17:07:18 +0100 Subject: [PATCH 11/16] HHH-14650 Optimise AbstractRowReader for iterations on entity initializers --- .../exec/process/internal/AbstractRowReader.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/loader/plan/exec/process/internal/AbstractRowReader.java b/hibernate-core/src/main/java/org/hibernate/loader/plan/exec/process/internal/AbstractRowReader.java index 32f8b01870..dfd5be870e 100644 --- a/hibernate-core/src/main/java/org/hibernate/loader/plan/exec/process/internal/AbstractRowReader.java +++ b/hibernate-core/src/main/java/org/hibernate/loader/plan/exec/process/internal/AbstractRowReader.java @@ -46,7 +46,9 @@ import org.jboss.logging.Logger; public abstract class AbstractRowReader implements RowReader { private static final Logger log = CoreLogging.logger( AbstractRowReader.class ); - private final List entityReferenceInitializers; + private static final EntityReferenceInitializer[] EMPTY_REFERENCE_INITIALIZERS = new EntityReferenceInitializer[0]; + + private final EntityReferenceInitializer[] entityReferenceInitializers; private final List arrayReferenceInitializers; private final List collectionReferenceInitializers; @@ -56,11 +58,9 @@ public abstract class AbstractRowReader implements RowReader { public AbstractRowReader(ReaderCollector readerCollector) { if ( CollectionHelper.isNotEmpty( readerCollector.getEntityReferenceInitializers() ) ) { - entityReferenceInitializers = new ArrayList( - readerCollector.getEntityReferenceInitializers() - ); + entityReferenceInitializers = readerCollector.getEntityReferenceInitializers().toArray( EMPTY_REFERENCE_INITIALIZERS ); entityInitializerByEntityReference = - new HashMap( entityReferenceInitializers.size() ); + new HashMap( entityReferenceInitializers.length ); for ( EntityReferenceInitializer entityReferenceInitializer : entityReferenceInitializers ) { entityInitializerByEntityReference.put( entityReferenceInitializer.getEntityReference(), @@ -69,7 +69,7 @@ public abstract class AbstractRowReader implements RowReader { } } else { - entityReferenceInitializers = Collections.emptyList(); + entityReferenceInitializers = EMPTY_REFERENCE_INITIALIZERS; entityInitializerByEntityReference = Collections.emptyMap(); } this.arrayReferenceInitializers = readerCollector.getArrayReferenceInitializers(); @@ -82,7 +82,7 @@ public abstract class AbstractRowReader implements RowReader { @Override public Object readRow(ResultSet resultSet, ResultSetProcessingContextImpl context) throws SQLException { - final boolean hasEntityReferenceInitializers = CollectionHelper.isNotEmpty( entityReferenceInitializers ); + final boolean hasEntityReferenceInitializers = entityReferenceInitializers.length != 0; if ( hasEntityReferenceInitializers ) { // 1) allow entity references to resolve identifiers (in 2 steps) From fb69172a4b0f42741b3b48b73dc01c2f1bcbd95c Mon Sep 17 00:00:00 2001 From: Sanne Grinovero Date: Thu, 3 Jun 2021 10:07:19 +0100 Subject: [PATCH 12/16] HHH-14650 AbstractRowReader: no need to pre-compute the entityInitializerByEntityReference cache in advance --- .../process/internal/AbstractRowReader.java | 45 ++++++++----------- 1 file changed, 19 insertions(+), 26 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/loader/plan/exec/process/internal/AbstractRowReader.java b/hibernate-core/src/main/java/org/hibernate/loader/plan/exec/process/internal/AbstractRowReader.java index dfd5be870e..c511fd61ad 100644 --- a/hibernate-core/src/main/java/org/hibernate/loader/plan/exec/process/internal/AbstractRowReader.java +++ b/hibernate-core/src/main/java/org/hibernate/loader/plan/exec/process/internal/AbstractRowReader.java @@ -8,7 +8,6 @@ package org.hibernate.loader.plan.exec.process.internal; import java.sql.ResultSet; import java.sql.SQLException; -import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -16,12 +15,9 @@ import java.util.Map; import org.hibernate.engine.internal.TwoPhaseLoad; import org.hibernate.engine.spi.SharedSessionContractImplementor; -import org.hibernate.event.service.spi.EventListenerRegistry; import org.hibernate.event.spi.EventSource; -import org.hibernate.event.spi.EventType; import org.hibernate.event.spi.PostLoadEvent; import org.hibernate.event.spi.PreLoadEvent; -import org.hibernate.event.spi.PreLoadEventListener; import org.hibernate.internal.CoreLogging; import org.hibernate.internal.util.collections.CollectionHelper; import org.hibernate.loader.plan.exec.process.spi.CollectionReferenceInitializer; @@ -54,24 +50,10 @@ public abstract class AbstractRowReader implements RowReader { // cache map for looking up EntityReferenceInitializer by EntityReference to help with resolving // bidirectional EntityReference and fetches. - private final Map entityInitializerByEntityReference; + private Map entityInitializerByEntityReference; public AbstractRowReader(ReaderCollector readerCollector) { - if ( CollectionHelper.isNotEmpty( readerCollector.getEntityReferenceInitializers() ) ) { - entityReferenceInitializers = readerCollector.getEntityReferenceInitializers().toArray( EMPTY_REFERENCE_INITIALIZERS ); - entityInitializerByEntityReference = - new HashMap( entityReferenceInitializers.length ); - for ( EntityReferenceInitializer entityReferenceInitializer : entityReferenceInitializers ) { - entityInitializerByEntityReference.put( - entityReferenceInitializer.getEntityReference(), - entityReferenceInitializer - ); - } - } - else { - entityReferenceInitializers = EMPTY_REFERENCE_INITIALIZERS; - entityInitializerByEntityReference = Collections.emptyMap(); - } + this.entityReferenceInitializers = readerCollector.getEntityReferenceInitializers().toArray( EMPTY_REFERENCE_INITIALIZERS ); this.arrayReferenceInitializers = readerCollector.getArrayReferenceInitializers(); this.collectionReferenceInitializers = readerCollector.getNonArrayCollectionReferenceInitializers(); } @@ -148,9 +130,7 @@ public abstract class AbstractRowReader implements RowReader { FetchSource fetchSource) throws SQLException { // Resolve any bidirectional entity references first. for ( BidirectionalEntityReference bidirectionalEntityReference : fetchSource.getBidirectionalEntityReferences() ) { - final EntityReferenceInitializer targetEntityReferenceInitializer = entityInitializerByEntityReference.get( - bidirectionalEntityReference.getTargetEntityReference() - ); + final EntityReferenceInitializer targetEntityReferenceInitializer = getInitializerByEntityReference( bidirectionalEntityReference.getTargetEntityReference() ); resolveEntityKey( resultSet, context, @@ -161,9 +141,7 @@ public abstract class AbstractRowReader implements RowReader { for ( Fetch fetch : fetchSource.getFetches() ) { if ( EntityFetch.class.isInstance( fetch ) ) { final EntityFetch entityFetch = (EntityFetch) fetch; - final EntityReferenceInitializer entityReferenceInitializer = entityInitializerByEntityReference.get( - entityFetch - ); + final EntityReferenceInitializer entityReferenceInitializer = getInitializerByEntityReference( entityFetch ); if ( entityReferenceInitializer != null ) { resolveEntityKey( resultSet, @@ -183,6 +161,21 @@ public abstract class AbstractRowReader implements RowReader { } } + private EntityReferenceInitializer getInitializerByEntityReference(EntityReference targetEntityReference) { + if ( entityInitializerByEntityReference == null ) { + entityInitializerByEntityReference = new HashMap<>( entityReferenceInitializers.length ); + for ( EntityReferenceInitializer entityReferenceInitializer : entityReferenceInitializers ) { + entityInitializerByEntityReference.put( + entityReferenceInitializer.getEntityReference(), + entityReferenceInitializer + ); + } + } + return entityInitializerByEntityReference.get( + targetEntityReference + ); + } + @Override public void finishUp(ResultSetProcessingContextImpl context, List afterLoadActionList) { final List hydratedEntityRegistrations = context.getHydratedEntityRegistrationList(); From 84e7c5f63ba97823a95ddb8c0553e6ee1c3196be Mon Sep 17 00:00:00 2001 From: Sanne Grinovero Date: Thu, 3 Jun 2021 10:12:26 +0100 Subject: [PATCH 13/16] HHH-14650 AbstractRowReader: remove unnecessary nullchecks --- .../exec/process/internal/AbstractRowReader.java | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/loader/plan/exec/process/internal/AbstractRowReader.java b/hibernate-core/src/main/java/org/hibernate/loader/plan/exec/process/internal/AbstractRowReader.java index c511fd61ad..56db17060e 100644 --- a/hibernate-core/src/main/java/org/hibernate/loader/plan/exec/process/internal/AbstractRowReader.java +++ b/hibernate-core/src/main/java/org/hibernate/loader/plan/exec/process/internal/AbstractRowReader.java @@ -97,15 +97,11 @@ public abstract class AbstractRowReader implements RowReader { entityReferenceInitializer.finishUpRow( resultSet, context ); } } - if ( collectionReferenceInitializers != null ) { - for ( CollectionReferenceInitializer collectionReferenceInitializer : collectionReferenceInitializers ) { - collectionReferenceInitializer.finishUpRow( resultSet, context ); - } + for ( CollectionReferenceInitializer collectionReferenceInitializer : collectionReferenceInitializers ) { + collectionReferenceInitializer.finishUpRow( resultSet, context ); } - if ( arrayReferenceInitializers != null ) { - for ( CollectionReferenceInitializer arrayReferenceInitializer : arrayReferenceInitializers ) { - arrayReferenceInitializer.finishUpRow( resultSet, context ); - } + for ( CollectionReferenceInitializer arrayReferenceInitializer : arrayReferenceInitializers ) { + arrayReferenceInitializer.finishUpRow( resultSet, context ); } return logicalRow; From 5579a38d4d9de5e702a762bb7c7bb15d98936d23 Mon Sep 17 00:00:00 2001 From: Sanne Grinovero Date: Thu, 3 Jun 2021 10:14:35 +0100 Subject: [PATCH 14/16] HHH-14650 AbstractRowReader: remove more redundant checks --- .../process/internal/AbstractRowReader.java | 42 +++++++------------ 1 file changed, 16 insertions(+), 26 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/loader/plan/exec/process/internal/AbstractRowReader.java b/hibernate-core/src/main/java/org/hibernate/loader/plan/exec/process/internal/AbstractRowReader.java index 56db17060e..3f80975a2e 100644 --- a/hibernate-core/src/main/java/org/hibernate/loader/plan/exec/process/internal/AbstractRowReader.java +++ b/hibernate-core/src/main/java/org/hibernate/loader/plan/exec/process/internal/AbstractRowReader.java @@ -63,39 +63,29 @@ public abstract class AbstractRowReader implements RowReader { @Override public Object readRow(ResultSet resultSet, ResultSetProcessingContextImpl context) throws SQLException { - - final boolean hasEntityReferenceInitializers = entityReferenceInitializers.length != 0; - - if ( hasEntityReferenceInitializers ) { - // 1) allow entity references to resolve identifiers (in 2 steps) - for ( EntityReferenceInitializer entityReferenceInitializer : entityReferenceInitializers ) { - entityReferenceInitializer.hydrateIdentifier( resultSet, context ); - } - for ( EntityReferenceInitializer entityReferenceInitializer : entityReferenceInitializers ) { - resolveEntityKey( - resultSet, - context, - entityReferenceInitializer - ); - } - - // 2) allow entity references to resolve their non-identifier hydrated state and entity instance - for ( EntityReferenceInitializer entityReferenceInitializer : entityReferenceInitializers ) { - entityReferenceInitializer.hydrateEntityState( resultSet, context ); - } + // 1) allow entity references to resolve identifiers (in 2 steps) + for ( EntityReferenceInitializer entityReferenceInitializer : entityReferenceInitializers ) { + entityReferenceInitializer.hydrateIdentifier( resultSet, context ); + } + for ( EntityReferenceInitializer entityReferenceInitializer : entityReferenceInitializers ) { + resolveEntityKey( + resultSet, + context, + entityReferenceInitializer + ); } + // 2) allow entity references to resolve their non-identifier hydrated state and entity instance + for ( EntityReferenceInitializer entityReferenceInitializer : entityReferenceInitializers ) { + entityReferenceInitializer.hydrateEntityState( resultSet, context ); + } // 3) read the logical row - Object logicalRow = readLogicalRow( resultSet, context ); - // 4) allow arrays, entities and collections after row callbacks - if ( hasEntityReferenceInitializers ) { - for ( EntityReferenceInitializer entityReferenceInitializer : entityReferenceInitializers ) { - entityReferenceInitializer.finishUpRow( resultSet, context ); - } + for ( EntityReferenceInitializer entityReferenceInitializer : entityReferenceInitializers ) { + entityReferenceInitializer.finishUpRow( resultSet, context ); } for ( CollectionReferenceInitializer collectionReferenceInitializer : collectionReferenceInitializers ) { collectionReferenceInitializer.finishUpRow( resultSet, context ); From d828bfb0867fc86057acde809b4730f6610db17a Mon Sep 17 00:00:00 2001 From: "nathan.xu" Date: Wed, 2 Jun 2021 17:14:23 -0400 Subject: [PATCH 15/16] HHH-14641 replace 'http://' reference with 'https://' --- CONTRIBUTING.md | 14 +++++----- README.md | 12 ++++---- documentation/documentation.gradle | 6 ++-- .../asciidoc/integrationguide/Preface.adoc | 2 +- .../asciidoc/quickstart/guides/obtaining.adoc | 16 +++++------ .../asciidoc/quickstart/guides/preface.adoc | 10 +++---- .../guides/tutorial_annotations.adoc | 4 +-- .../metamodelgen/MetamodelGenerator.adoc | 8 +++--- .../topical/registries/ServiceRegistries.adoc | 2 +- .../asciidoc/topical/wildfly/Wildfly.adoc | 2 +- .../src/main/asciidoc/userguide/Preface.adoc | 14 +++++----- .../userguide/appendices/Annotations.adoc | 2 +- .../userguide/appendices/BestPractices.adoc | 4 +-- .../userguide/appendices/Configurations.adoc | 12 ++++---- .../userguide/chapters/batch/Batching.adoc | 2 +- .../userguide/chapters/caching/Caching.adoc | 8 +++--- .../chapters/domain/basic_types.adoc | 2 +- .../userguide/chapters/domain/entity.adoc | 4 +-- .../userguide/chapters/envers/Envers.adoc | 4 +-- .../chapters/jdbc/Database_Access.adoc | 28 +++++++++---------- .../userguide/chapters/locking/Locking.adoc | 2 +- .../chapters/portability/Portability.adoc | 2 +- .../userguide/chapters/query/hql/HQL.adoc | 2 +- .../chapters/query/spatial/Spatial.adoc | 4 +-- .../chapters/transactions/Transactions.adoc | 2 +- gradle/published-java-module.gradle | 14 +++++----- gradle/publishing-pom.gradle | 14 +++++----- 27 files changed, 98 insertions(+), 98 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 81c00899ef..47752c2935 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -21,10 +21,10 @@ While we try to keep requirements for contributing to a minimum, there are a few we ask that you mind. For code contributions, these guidelines include: -* respect the project code style - find templates for [IntelliJ IDEA](https://community.jboss.org/docs/DOC-15468) or [Eclipse](https://community.jboss.org/docs/DOC-16649) +* respect the project code style - find templates for [IntelliJ IDEA](https://hibernate.org/community/contribute/intellij-idea/) or [Eclipse](https://hibernate.org/community/contribute/eclipse-ide/) * have a corresponding JIRA issue and the key for this JIRA issue should be used in the commit message * have a set of appropriate tests. For bug reports, the tests reproduce the initial reported bug - and illustrates that the solution actually fixes the bug. For features/enhancements, the + and illustrate that the solution actually fixes the bug. For features/enhancements, the tests illustrate the feature working as intended. In both cases the tests are incorporated into the project to protect against regressions * if applicable, documentation is updated to reflect the introduced changes @@ -47,14 +47,14 @@ GitHub there are a few pre-requisite steps to follow: the linked page, this also includes: * [set up your local git install](https://help.github.com/articles/set-up-git) * clone your fork -* See the wiki pages for setting up your IDE, whether you use -[IntelliJ IDEA](https://community.jboss.org/wiki/ContributingToHibernateUsingIntelliJ) -or [Eclipse](https://community.jboss.org/wiki/ContributingToHibernateUsingEclipse)(1). +* see the wiki pages for setting up your IDE, whether you use +[IntelliJ IDEA](https://hibernate.org/community/contribute/intellij-idea/) +or [Eclipse](https://hibernate.org/community/contribute/eclipse-ide/)(1). ## Create the working (topic) branch -Create a [topic branch](http://git-scm.com/book/en/Git-Branching-Branching-Workflows#Topic-Branches) +Create a [topic branch](https://git-scm.com/book/en/Git-Branching-Branching-Workflows#Topic-Branches) on which you will work. The convention is to incorporate the JIRA issue key in the name of this branch, although this is more of a mnemonic strategy than a hard-and-fast rule - but doing so helps: * remember what each branch is for @@ -87,7 +87,7 @@ appreciated btw), please use rebasing rather than merging. Merging creates ## Submit * push your changes to the topic branch in your fork of the repository -* initiate a [pull request](http://help.github.com/articles/creating-a-pull-request) +* initiate a [pull request](https://help.github.com/articles/creating-a-pull-request) * update the JIRA issue by providing the PR link in the **Pull Request** column on the right diff --git a/README.md b/README.md index 8f5a40840b..dc84c8ec51 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ - + Hibernate ORM is a library providing Object/Relational Mapping (ORM) support @@ -6,9 +6,9 @@ to applications, libraries, and frameworks. It also provides an implementation of the JPA specification, which is the standard Java specification for ORM. -This is the repository of its source code: see [Hibernate.org](http://hibernate.org/orm/) for additional information. +This is the repository of its source code: see [Hibernate.org](https://hibernate.org/orm/) for additional information. -[![Build Status](http://ci.hibernate.org/job/hibernate-orm-main-h2-main/badge/icon)](http://ci.hibernate.org/job/hibernate-orm-main-h2-main/) +[![Build Status](https://ci.hibernate.org/job/hibernate-orm-main-h2-main/badge/icon)](https://ci.hibernate.org/job/hibernate-orm-main-h2-main/) [![Language grade: Java](https://img.shields.io/lgtm/grade/java/g/hibernate/hibernate-orm.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/hibernate/hibernate-orm/context:java) Building from sources @@ -23,7 +23,7 @@ Gradle. Contributors should read the [Contributing Guide](CONTRIBUTING.md). -See the guides for setting up [IntelliJ](http://hibernate.org/community/contribute/intellij-idea/) or +See the guides for setting up [IntelliJ](https://hibernate.org/community/contribute/intellij-idea/) or [Eclipse](https://hibernate.org/community/contribute/eclipse-ide/) as your development environment. Check out the _Getting Started_ section in CONTRIBUTING.md for getting started working on Hibernate source. @@ -32,9 +32,9 @@ Check out the _Getting Started_ section in CONTRIBUTING.md for getting started w Continuous Integration ========= -Hibernate makes use of [Jenkins](http://jenkins-ci.org) for its CI needs. The project is built continuous on each +Hibernate makes use of [Jenkins](https://jenkins-ci.org) for its CI needs. The project is built continuous on each push to the upstream repository. Overall there are a few different jobs, all of which can be seen at -[http://ci.hibernate.org/view/ORM/](http://ci.hibernate.org/view/ORM/) +[https://ci.hibernate.org/view/ORM/](https://ci.hibernate.org/view/ORM/) Gradle primer diff --git a/documentation/documentation.gradle b/documentation/documentation.gradle index 88ca535866..275e27527a 100644 --- a/documentation/documentation.gradle +++ b/documentation/documentation.gradle @@ -119,14 +119,14 @@ task aggregateJavadocs(type: Javadoc) { overview = project.file( 'src/main/javadoc/overview.html' ) windowTitle = 'Hibernate JavaDocs' docTitle = "Hibernate JavaDoc ($project.version)" - bottom = "Copyright © 2001-$currentYear Red Hat, Inc. All Rights Reserved." + bottom = "Copyright © 2001-$currentYear Red Hat, Inc. All Rights Reserved." use = true options.encoding = 'UTF-8' links = [ 'https://docs.oracle.com/javase/8/docs/api/', - 'http://docs.jboss.org/hibernate/beanvalidation/spec/2.0/api/', - 'http://docs.jboss.org/cdi/api/2.0/', + 'https://docs.jboss.org/hibernate/beanvalidation/spec/2.0/api/', + 'https://docs.jboss.org/cdi/api/2.0/', 'https://javaee.github.io/javaee-spec/javadocs/' ] diff --git a/documentation/src/main/asciidoc/integrationguide/Preface.adoc b/documentation/src/main/asciidoc/integrationguide/Preface.adoc index 0223536c22..d348dc231a 100644 --- a/documentation/src/main/asciidoc/integrationguide/Preface.adoc +++ b/documentation/src/main/asciidoc/integrationguide/Preface.adoc @@ -1,7 +1,7 @@ [[preface]] == Preface -Hibernate is an http://en.wikipedia.org/wiki/Object-relational_mapping[Object/Relational Mapping] solution for Java environments. +Hibernate is an https://en.wikipedia.org/wiki/Object-relational_mapping[Object/Relational Mapping] solution for Java environments. Hibernate not only takes care of the mapping from Java classes to database tables (and from Java data types to SQL data types), but also provides data query and retrieval facilities. It can significantly reduce development time otherwise spent with manual data handling in SQL and JDBC. diff --git a/documentation/src/main/asciidoc/quickstart/guides/obtaining.adoc b/documentation/src/main/asciidoc/quickstart/guides/obtaining.adoc index 58cb23b7a3..bfab8989a9 100644 --- a/documentation/src/main/asciidoc/quickstart/guides/obtaining.adoc +++ b/documentation/src/main/asciidoc/quickstart/guides/obtaining.adoc @@ -9,14 +9,14 @@ hibernate-core:: The main (core) Hibernate module. Defines its ORM features and hibernate-envers:: Hibernate's historical entity versioning feature hibernate-spatial:: Hibernate's Spatial/GIS data-type support hibernate-osgi:: Hibernate support for running in OSGi containers. -hibernate-agroal:: Integrates the http://agroal.github.io/[Agroal] connection pooling library into Hibernate -hibernate-c3p0:: Integrates the http://www.mchange.com/projects/c3p0/[C3P0] connection pooling library into Hibernate +hibernate-agroal:: Integrates the https://agroal.github.io/[Agroal] connection pooling library into Hibernate +hibernate-c3p0:: Integrates the https://www.mchange.com/projects/c3p0/[C3P0] connection pooling library into Hibernate hibernate-hikaricp:: Integrates the https://github.com/brettwooldridge/HikariCP/[HikariCP] connection pooling library into Hibernate -hibernate-vibur:: Integrates the http://www.vibur.org/[Vibur DBCP] connection pooling library into Hibernate -hibernate-proxool:: Integrates the http://proxool.sourceforge.net/[Proxool] connection pooling library into Hibernate +hibernate-vibur:: Integrates the https://www.vibur.org/[Vibur DBCP] connection pooling library into Hibernate +hibernate-proxool:: Integrates the https://proxool.sourceforge.net/[Proxool] connection pooling library into Hibernate hibernate-jcache:: Integrates the https://jcp.org/en/jsr/detail?id=107$$[JCache] caching specification into Hibernate, enabling any compliant implementation to become a second-level cache provider. -hibernate-ehcache:: Integrates the http://ehcache.org/[Ehcache] caching library into Hibernate as a second-level cache provider. +hibernate-ehcache:: Integrates the https://ehcache.org/[Ehcache] caching library into Hibernate as a second-level cache provider. === Release Bundle Downloads @@ -43,10 +43,10 @@ synced to Maven Central as part of an automated job (some small delay may occur) The team responsible for the JBoss Maven repository maintains a number of Wiki pages that contain important information: -* http://community.jboss.org/docs/DOC-14900 - General information about the repository. -* http://community.jboss.org/docs/DOC-15170 - Information about setting up the JBoss repositories in order to do +* https://community.jboss.org/docs/DOC-14900 - General information about the repository. +* https://community.jboss.org/docs/DOC-15170 - Information about setting up the JBoss repositories in order to do development work on JBoss projects themselves. -* http://community.jboss.org/docs/DOC-15169 - Information about setting up access to the repository to use JBoss +* https://community.jboss.org/docs/DOC-15169 - Information about setting up access to the repository to use JBoss projects as part of your own software. The Hibernate ORM artifacts are published under the `org.hibernate` groupId. \ No newline at end of file diff --git a/documentation/src/main/asciidoc/quickstart/guides/preface.adoc b/documentation/src/main/asciidoc/quickstart/guides/preface.adoc index 9cdc505b63..03bc59fd15 100644 --- a/documentation/src/main/asciidoc/quickstart/guides/preface.adoc +++ b/documentation/src/main/asciidoc/quickstart/guides/preface.adoc @@ -7,14 +7,14 @@ Working with both Object-Oriented software and Relational Databases can be cumbe Development costs are significantly higher due to a number of "paradigm mismatches" between how data is represented in objects versus relational databases. Hibernate is an Object/Relational Mapping (ORM) solution for Java environments. The term Object/Relational Mapping refers to the technique of mapping data between an object model representation to -a relational data model representation. See http://en.wikipedia.org/wiki/Object-relational_mapping for a good -high-level discussion. Also, Martin Fowler's link:$$http://martinfowler.com/bliki/OrmHate.html$$[OrmHate] article +a relational data model representation. See https://en.wikipedia.org/wiki/Object-relational_mapping for a good +high-level discussion. Also, Martin Fowler's link:$$https://martinfowler.com/bliki/OrmHate.html$$[OrmHate] article takes a look at many of the mismatch problems. Although having a strong background in SQL is not required to use Hibernate, having a basic understanding of the concepts can help you understand Hibernate more quickly and fully. An understanding of data modeling principles -is especially important. Both http://www.agiledata.org/essays/dataModeling101.html and -http://en.wikipedia.org/wiki/Data_modeling are good starting points for understanding these data modeling +is especially important. Both https://www.agiledata.org/essays/dataModeling101.html and +https://en.wikipedia.org/wiki/Data_modeling are good starting points for understanding these data modeling principles. If you are completely new to database access in Java, https://www.marcobehler.com/guides/a-guide-to-accessing-databases-in-java contains a good overview of the various parts, pieces and options. @@ -33,6 +33,6 @@ logic in the Java-based middle-tier. However, Hibernate can certainly help you t vendor-specific SQL code and streamlines the common task of translating result sets from a tabular representation to a graph of objects. -See http://hibernate.org/orm/contribute/ for information on getting involved. +See https://hibernate.org/orm/contribute/ for information on getting involved. IMPORTANT: The projects and code for the tutorials referenced in this guide are available as link:hibernate-tutorials.zip[] diff --git a/documentation/src/main/asciidoc/quickstart/guides/tutorial_annotations.adoc b/documentation/src/main/asciidoc/quickstart/guides/tutorial_annotations.adoc index 3bf9f8e973..6c4a588e81 100644 --- a/documentation/src/main/asciidoc/quickstart/guides/tutorial_annotations.adoc +++ b/documentation/src/main/asciidoc/quickstart/guides/tutorial_annotations.adoc @@ -98,7 +98,7 @@ any mapping information associated with `title`. .Practice Exercises - [ ] Add an association to the `Event` entity to model a message thread. Use the -http://docs.jboss.org/hibernate/orm/current/userguide/html_single/Hibernate_User_Guide.html[_User Guide_] for more details. +https://docs.jboss.org/hibernate/orm/current/userguide/html_single/Hibernate_User_Guide.html[_User Guide_] for more details. - [ ] Add a callback to receive notifications when an `Event` is created, updated or deleted. Try the same with an event listener. Use the -http://docs.jboss.org/hibernate/orm/current/userguide/html_single/Hibernate_User_Guide.html[_User Guide_] for more details. +https://docs.jboss.org/hibernate/orm/current/userguide/html_single/Hibernate_User_Guide.html[_User Guide_] for more details. diff --git a/documentation/src/main/asciidoc/topical/metamodelgen/MetamodelGenerator.adoc b/documentation/src/main/asciidoc/topical/metamodelgen/MetamodelGenerator.adoc index 65dac38984..9aba27c3dc 100644 --- a/documentation/src/main/asciidoc/topical/metamodelgen/MetamodelGenerator.adoc +++ b/documentation/src/main/asciidoc/topical/metamodelgen/MetamodelGenerator.adoc @@ -12,7 +12,7 @@ static metamodel classes. For developers it is important that the task of the metamodel generation can be automated. Hibernate Static Metamodel Generator is an annotation processor based on -http://jcp.org/en/jsr/detail?id=269[JSR_269] with the task of creating JPA 2 +https://jcp.org/en/jsr/detail?id=269[JSR_269] with the task of creating JPA 2 static metamodel classes. The following example shows two JPA 2 entities `Order` and `Item`, together with the metamodel class `Order_` and a typesafe query. @@ -111,7 +111,7 @@ persistence unit metadata: == Canonical Metamodel The structure of the metamodel classes is described in the JPA 2 -(JSR 317) http://jcp.org/en/jsr/detail?id=317[specification], but for +(JSR 317) https://jcp.org/en/jsr/detail?id=317[specification], but for completeness the definition is repeated in the following paragraphs. Feel free to skip ahead to the <>, if you are not interested into the gory details. @@ -258,9 +258,9 @@ pass the processor option to the compiler plugin: ==== The maven-compiler-plugin approach has the disadvantage that the maven compiler plugin does currently not allow to specify multiple compiler arguments -(http://jira.codehaus.org/browse/MCOMPILER-62[MCOMPILER-62]) +(https://jira.codehaus.org/browse/MCOMPILER-62[MCOMPILER-62]) and that messages from the Messenger API are suppressed -(http://jira.codehaus.org/browse/MCOMPILER-66[MCOMPILER-66]). +(https://jira.codehaus.org/browse/MCOMPILER-66[MCOMPILER-66]). A better approach is to disable annotation processing for the compiler plugin as seen in below. diff --git a/documentation/src/main/asciidoc/topical/registries/ServiceRegistries.adoc b/documentation/src/main/asciidoc/topical/registries/ServiceRegistries.adoc index 856dba0fc0..0f8042ce80 100644 --- a/documentation/src/main/asciidoc/topical/registries/ServiceRegistries.adoc +++ b/documentation/src/main/asciidoc/topical/registries/ServiceRegistries.adoc @@ -343,7 +343,7 @@ service to be injected is optional, use `InjectService#required=false`. Once built, a ServiceRegistry is generally considered immutable. The Services themselves might accept re-configuration, but immutability here means adding/replacing services. So all the services hosted in a particular ServiceRegistry must be known up-front. To this end, building a ServiceRegistry usually employees a -http://en.wikipedia.org/wiki/Builder_pattern[builder^]. +https://en.wikipedia.org/wiki/Builder_pattern[builder^]. === Building BootstrapServiceRegistry diff --git a/documentation/src/main/asciidoc/topical/wildfly/Wildfly.adoc b/documentation/src/main/asciidoc/topical/wildfly/Wildfly.adoc index 146fbb5f1a..0c7eb59879 100644 --- a/documentation/src/main/asciidoc/topical/wildfly/Wildfly.adoc +++ b/documentation/src/main/asciidoc/topical/wildfly/Wildfly.adoc @@ -2,7 +2,7 @@ == Hibernate ORM within WildFly -The http://wildfly.org/[WildFly application server] includes Hibernate ORM as the default JPA provider out of the box. +The https://wildfly.org/[WildFly application server] includes Hibernate ORM as the default JPA provider out of the box. In previous versions of Hibernate ORM, we offered a "feature pack" to enable anyone to use the very latest version in WildFly as soon as a new release of Hibernate ORM was published. diff --git a/documentation/src/main/asciidoc/userguide/Preface.adoc b/documentation/src/main/asciidoc/userguide/Preface.adoc index 56ccbdfdfc..95c422c70e 100644 --- a/documentation/src/main/asciidoc/userguide/Preface.adoc +++ b/documentation/src/main/asciidoc/userguide/Preface.adoc @@ -4,7 +4,7 @@ Working with both Object-Oriented software and Relational Databases can be cumbersome and time-consuming. Development costs are significantly higher due to a paradigm mismatch between how data is represented in objects versus relational databases. Hibernate is an Object/Relational Mapping solution for Java environments. -The term http://en.wikipedia.org/wiki/Object-relational_mapping[Object/Relational Mapping] refers to the technique of mapping data from an object model representation to a relational data model representation (and vice versa). +The term https://en.wikipedia.org/wiki/Object-relational_mapping[Object/Relational Mapping] refers to the technique of mapping data from an object model representation to a relational data model representation (and vice versa). Hibernate not only takes care of the mapping from Java classes to database tables (and from Java data types to SQL data types), but also provides data query and retrieval facilities. It can significantly reduce development time otherwise spent with manual data handling in SQL and JDBC. @@ -16,9 +16,9 @@ However, Hibernate can certainly help you to remove or encapsulate vendor-specif === Get Involved -* Use Hibernate and report any bugs or issues you find. See http://hibernate.org/issuetracker[Issue Tracker] for details. -* Try your hand at fixing some bugs or implementing enhancements. Again, see http://hibernate.org/issuetracker[Issue Tracker]. -* Engage with the community using mailing lists, forums, IRC, or other ways listed in the http://hibernate.org/community[Community section]. +* Use Hibernate and report any bugs or issues you find. See https://hibernate.org/issuetracker[Issue Tracker] for details. +* Try your hand at fixing some bugs or implementing enhancements. Again, see https://hibernate.org/issuetracker[Issue Tracker]. +* Engage with the community using mailing lists, forums, IRC, or other ways listed in the https://hibernate.org/community[Community section]. * Help improve or translate this documentation. Contact us on the developer mailing list if you have interest. * Spread the word. Let the rest of your organization know about the benefits of Hibernate. @@ -36,7 +36,7 @@ When building Hibernate 5.1 or older from sources, you need Java 1.7 due to a bu === Getting Started Guide New users may want to first look through the https://docs.jboss.org/hibernate/orm/{majorMinorVersion}/quickstart/html_single/[Hibernate Getting Started Guide] for basic information as well as tutorials. -There is also a series of http://docs.jboss.org/hibernate/orm/{majorMinorVersion}/topical/html_single/[topical guides] providing deep dives into various topics. +There is also a series of https://docs.jboss.org/hibernate/orm/{majorMinorVersion}/topical/html_single/[topical guides] providing deep dives into various topics. [NOTE] ==== @@ -44,8 +44,8 @@ While having a strong background in SQL is not required to use Hibernate, it cer Probably even more important is an understanding of data modeling principles. You might want to consider these resources as a good starting point: -* http://en.wikipedia.org/wiki/Data_modeling[Data modeling Wikipedia definition] -* http://www.agiledata.org/essays/dataModeling101.html[Data Modeling 101] +* https://en.wikipedia.org/wiki/Data_modeling[Data modeling Wikipedia definition] +* https://www.agiledata.org/essays/dataModeling101.html[Data Modeling 101] Understanding the basics of transactions and design patterns such as _Unit of Work_ (<>) or _Application Transaction_ are important as well. These topics will be discussed in the documentation, but a prior understanding will certainly help. diff --git a/documentation/src/main/asciidoc/userguide/appendices/Annotations.adoc b/documentation/src/main/asciidoc/userguide/appendices/Annotations.adoc index 61af303f92..d2170f6a99 100644 --- a/documentation/src/main/asciidoc/userguide/appendices/Annotations.adoc +++ b/documentation/src/main/asciidoc/userguide/appendices/Annotations.adoc @@ -674,7 +674,7 @@ See the <> chapter for more info. [[annotations-hibernate-cascade]] ==== `@Cascade` -The https://docs.jboss.org/hibernate/orm/{majorMinorVersion}/javadocs/org/hibernate/annotations/Cascade.html[`@Cascade`] annotation is used to apply the Hibernate specific http://docs.jboss.org/hibernate/orm/{majorMinorVersion}/javadocs/org/hibernate/annotations/CascadeType.html[`CascadeType`] strategies (e.g. `CascadeType.LOCK`, `CascadeType.SAVE_UPDATE`, `CascadeType.REPLICATE`) on a given association. +The https://docs.jboss.org/hibernate/orm/{majorMinorVersion}/javadocs/org/hibernate/annotations/Cascade.html[`@Cascade`] annotation is used to apply the Hibernate specific https://docs.jboss.org/hibernate/orm/{majorMinorVersion}/javadocs/org/hibernate/annotations/CascadeType.html[`CascadeType`] strategies (e.g. `CascadeType.LOCK`, `CascadeType.SAVE_UPDATE`, `CascadeType.REPLICATE`) on a given association. For JPA cascading, prefer using the {jpaJavadocUrlPrefix}CascadeType.html[`javax.persistence.CascadeType`] instead. diff --git a/documentation/src/main/asciidoc/userguide/appendices/BestPractices.adoc b/documentation/src/main/asciidoc/userguide/appendices/BestPractices.adoc index e1160a01f5..2fdae829cc 100644 --- a/documentation/src/main/asciidoc/userguide/appendices/BestPractices.adoc +++ b/documentation/src/main/asciidoc/userguide/appendices/BestPractices.adoc @@ -10,7 +10,7 @@ Hibernate comes with a great variety of features that can help you tune the data Although Hibernate provides the `update` option for the `hibernate.hbm2ddl.auto` configuration property, this feature is not suitable for a production environment. -An automated schema migration tool (e.g. https://flywaydb.org/[Flyway], http://www.liquibase.org/[Liquibase]) allows you to use any database-specific DDL feature (e.g. Rules, Triggers, Partitioned Tables). +An automated schema migration tool (e.g. https://flywaydb.org/[Flyway], https://www.liquibase.org/[Liquibase]) allows you to use any database-specific DDL feature (e.g. Rules, Triggers, Partitioned Tables). Every migration should have an associated script, which is stored on the Version Control System, along with the application source code. When the application is deployed on a production-like QA environment, and the deployment worked as expected, then pushing the deployment to a production environment should be straightforward since the latest schema migration was already tested. @@ -233,7 +233,7 @@ and you should consider these alternatives prior to jumping to a second-level ca After properly tuning the database, to further reduce the average response time and increase the system throughput, application-level caching becomes inevitable. -Typically, a key-value application-level cache like https://memcached.org/[Memcached] or http://redis.io/[Redis] is a common choice to store data aggregates. +Typically, a key-value application-level cache like https://memcached.org/[Memcached] or https://redis.io/[Redis] is a common choice to store data aggregates. If you can duplicate all data in the key-value store, you have the option of taking down the database system for maintenance without completely losing availability since read-only traffic can still be served from the cache. One of the main challenges of using an application-level cache is ensuring data consistency across entity aggregates. diff --git a/documentation/src/main/asciidoc/userguide/appendices/Configurations.adoc b/documentation/src/main/asciidoc/userguide/appendices/Configurations.adoc index 75ff5d99c9..832b9d7471 100644 --- a/documentation/src/main/asciidoc/userguide/appendices/Configurations.adoc +++ b/documentation/src/main/asciidoc/userguide/appendices/Configurations.adoc @@ -207,22 +207,22 @@ The number of seconds between two consecutive pool validations. During validatio === c3p0 properties `*hibernate.c3p0.min_size*` (e.g. 1):: - Minimum size of C3P0 connection pool. Refers to http://www.mchange.com/projects/c3p0/#minPoolSize[c3p0 `minPoolSize` setting]. + Minimum size of C3P0 connection pool. Refers to https://www.mchange.com/projects/c3p0/#minPoolSize[c3p0 `minPoolSize` setting]. `*hibernate.c3p0.max_size*` (e.g. 5):: - Maximum size of C3P0 connection pool. Refers to http://www.mchange.com/projects/c3p0/#maxPoolSize[c3p0 `maxPoolSize` setting]. + Maximum size of C3P0 connection pool. Refers to https://www.mchange.com/projects/c3p0/#maxPoolSize[c3p0 `maxPoolSize` setting]. `*hibernate.c3p0.timeout*` (e.g. 30):: - Maximum idle time for C3P0 connection pool. Refers to http://www.mchange.com/projects/c3p0/#maxIdleTime[c3p0 `maxIdleTime` setting]. + Maximum idle time for C3P0 connection pool. Refers to https://www.mchange.com/projects/c3p0/#maxIdleTime[c3p0 `maxIdleTime` setting]. `*hibernate.c3p0.max_statements*` (e.g. 5):: - Maximum size of C3P0 statement cache. Refers to http://www.mchange.com/projects/c3p0/#maxStatements[c3p0 `maxStatements` setting]. + Maximum size of C3P0 statement cache. Refers to https://www.mchange.com/projects/c3p0/#maxStatements[c3p0 `maxStatements` setting]. `*hibernate.c3p0.acquire_increment*` (e.g. 2):: - The number of connections acquired at a time when there's no connection available in the pool. Refers to http://www.mchange.com/projects/c3p0/#acquireIncrement[c3p0 `acquireIncrement` setting]. + The number of connections acquired at a time when there's no connection available in the pool. Refers to https://www.mchange.com/projects/c3p0/#acquireIncrement[c3p0 `acquireIncrement` setting]. `*hibernate.c3p0.idle_test_period*` (e.g. 5):: - Idle time before a C3P0 pooled connection is validated. Refers to http://www.mchange.com/projects/c3p0/#idleConnectionTestPeriod[c3p0 `idleConnectionTestPeriod` setting]. + Idle time before a C3P0 pooled connection is validated. Refers to https://www.mchange.com/projects/c3p0/#idleConnectionTestPeriod[c3p0 `idleConnectionTestPeriod` setting]. `*hibernate.c3p0*`:: A setting prefix used to indicate additional c3p0 properties that need to be passed to the underlying c3p0 connection pool. diff --git a/documentation/src/main/asciidoc/userguide/chapters/batch/Batching.adoc b/documentation/src/main/asciidoc/userguide/chapters/batch/Batching.adoc index 0d0cf10725..e53d55f1bf 100644 --- a/documentation/src/main/asciidoc/userguide/chapters/batch/Batching.adoc +++ b/documentation/src/main/asciidoc/userguide/chapters/batch/Batching.adoc @@ -489,7 +489,7 @@ However, this strategy requires the IN-clause row value expression for composite If you can use temporary tables, that's probably the best choice. However, if you are not allowed to create temporary tables, you must pick one of these four strategies that works with your underlying database. Before making up your mind, you should benchmark which one works best for your current workload. -For instance, http://blog.2ndquadrant.com/postgresql-ctes-are-optimization-fences/[CTE are optimization fences in PostgreSQL], so make sure you measure before making a decision. +For instance, https://blog.2ndquadrant.com/postgresql-ctes-are-optimization-fences/[CTE are optimization fences in PostgreSQL], so make sure you measure before making a decision. If you're using Oracle or MySQL 5.7, you can choose either `InlineIdsOrClauseBulkIdStrategy` or `InlineIdsInClauseBulkIdStrategy`. For older version of MySQL, then you can only use `InlineIdsOrClauseBulkIdStrategy`. diff --git a/documentation/src/main/asciidoc/userguide/chapters/caching/Caching.adoc b/documentation/src/main/asciidoc/userguide/chapters/caching/Caching.adoc index caf5ca65c1..51846edc3c 100644 --- a/documentation/src/main/asciidoc/userguide/chapters/caching/Caching.adoc +++ b/documentation/src/main/asciidoc/userguide/chapters/caching/Caching.adoc @@ -612,7 +612,7 @@ and also log a warning about the missing cache. ==== Note that caches created this way may not be suitable for production usage (unlimited size and no eviction in particular) unless the cache provider explicitly provides a specific configuration for default caches. -Ehcache, in particular, allows to set such default configuration using cache templates. See the http://www.ehcache.org/documentation/3.0/107.html#supplement-jsr-107-configurations[Ehcache documentation] for more details. +Ehcache, in particular, allows to set such default configuration using cache templates. See the https://www.ehcache.org/documentation/3.0/107.html#supplement-jsr-107-configurations[Ehcache documentation] for more details. ==== [[caching-provider-ehcache]] @@ -622,7 +622,7 @@ This integration covers Ehcache 2.x, in order to use Ehcache 3.x as second level [NOTE] ==== -Use of the built-in integration for http://www.ehcache.org/[Ehcache] requires that the `hibernate-ehcache` module jar (and all of its dependencies) are on the classpath. +Use of the built-in integration for https://www.ehcache.org/[Ehcache] requires that the `hibernate-ehcache` module jar (and all of its dependencies) are on the classpath. ==== [[caching-provider-ehcache-region-factory]] @@ -665,12 +665,12 @@ To use the `SingletonEhCacheRegionFactory`, you need to specify the following co ---- ==== -The `SingletonEhCacheRegionFactory` configures a singleton `net.sf.ehcache.CacheManager` (see http://www.ehcache.org/apidocs/2.8.4/net/sf/ehcache/CacheManager.html#create%28%29[CacheManager#create()]), +The `SingletonEhCacheRegionFactory` configures a singleton `net.sf.ehcache.CacheManager` (see https://www.ehcache.org/apidocs/2.8.4/net/sf/ehcache/CacheManager.html#create%28%29[CacheManager#create()]), shared among multiple `SessionFactory` instances in the same JVM. [NOTE] ==== -The http://www.ehcache.org/documentation/2.8/integrations/hibernate#optional[Ehcache documentation] recommends using multiple non-singleton ``CacheManager``s when there are multiple Hibernate `SessionFactory` instances running in the same JVM. +The https://www.ehcache.org/documentation/2.8/integrations/hibernate#optional[Ehcache documentation] recommends using multiple non-singleton ``CacheManager``s when there are multiple Hibernate `SessionFactory` instances running in the same JVM. ==== [[caching-provider-ehcache-missing-cache-strategy]] diff --git a/documentation/src/main/asciidoc/userguide/chapters/domain/basic_types.adoc b/documentation/src/main/asciidoc/userguide/chapters/domain/basic_types.adoc index fe48168638..a5544a778d 100644 --- a/documentation/src/main/asciidoc/userguide/chapters/domain/basic_types.adoc +++ b/documentation/src/main/asciidoc/userguide/chapters/domain/basic_types.adoc @@ -199,7 +199,7 @@ But first, let's explore how implicit resolution works and how applications can ==== A thorough discussion of `BasicTypeRegistry` and all the different ways to contribute types is beyond the scope of this documentation. -Please see the http://docs.jboss.org/hibernate/orm/{majorMinorVersion}/integrationguide/html_single/Hibernate_Integration_Guide.html[Integration Guide] for complete details. +Please see the https://docs.jboss.org/hibernate/orm/{majorMinorVersion}/integrationguide/html_single/Hibernate_Integration_Guide.html[Integration Guide] for complete details. ==== As an example, take a String attribute such as we saw before with Product#sku. diff --git a/documentation/src/main/asciidoc/userguide/chapters/domain/entity.adoc b/documentation/src/main/asciidoc/userguide/chapters/domain/entity.adoc index 42d154f1de..4b7235f33e 100644 --- a/documentation/src/main/asciidoc/userguide/chapters/domain/entity.adoc +++ b/documentation/src/main/asciidoc/userguide/chapters/domain/entity.adoc @@ -455,8 +455,8 @@ Hibernate will trigger a Persistence Context flush if there are pending `Account ==== Define a custom entity proxy By default, when it needs to use a proxy instead of the actual POJO, Hibernate is going to use a Bytecode manipulation library like -http://jboss-javassist.github.io/javassist/[Javassist] or -http://bytebuddy.net/[Byte Buddy]. +https://jboss-javassist.github.io/javassist/[Javassist] or +https://bytebuddy.net/[Byte Buddy]. However, if the entity class is final, Javassist will not create a proxy and you will get a POJO even when you only need a proxy reference. In this case, you could proxy an interface that this particular entity implements, as illustrated by the following example. diff --git a/documentation/src/main/asciidoc/userguide/chapters/envers/Envers.adoc b/documentation/src/main/asciidoc/userguide/chapters/envers/Envers.adoc index 17552968f0..af0e847abc 100644 --- a/documentation/src/main/asciidoc/userguide/chapters/envers/Envers.adoc +++ b/documentation/src/main/asciidoc/userguide/chapters/envers/Envers.adoc @@ -1580,8 +1580,8 @@ And sometime in 2011, the last partition (or 'extension bucket') is split into t [[envers-links]] === Envers links -. http://hibernate.org[Hibernate main page] -. http://hibernate.org/community/[Forum] +. https://hibernate.org[Hibernate main page] +. https://hibernate.org/community/[Forum] . https://hibernate.atlassian.net/[JIRA issue tracker] (when adding issues concerning Envers, be sure to select the "envers" component!) . https://hibernate.zulipchat.com/#narrow/stream/132096-hibernate-user[Zulip channel] . https://community.jboss.org/wiki/EnversFAQ[FAQ] diff --git a/documentation/src/main/asciidoc/userguide/chapters/jdbc/Database_Access.adoc b/documentation/src/main/asciidoc/userguide/chapters/jdbc/Database_Access.adoc index 4d2ef0ed3d..adf7b217ab 100644 --- a/documentation/src/main/asciidoc/userguide/chapters/jdbc/Database_Access.adoc +++ b/documentation/src/main/asciidoc/userguide/chapters/jdbc/Database_Access.adoc @@ -55,20 +55,20 @@ NOTE: Not all properties apply to all situations. For example, if you are provid To use the c3p0 integration, the application must include the `hibernate-c3p0` module jar (as well as its dependencies) on the classpath. ==== -Hibernate also provides support for applications to use http://www.mchange.com/projects/c3p0/[c3p0] connection pooling. +Hibernate also provides support for applications to use https://www.mchange.com/projects/c3p0/[c3p0] connection pooling. When c3p0 support is enabled, a number of c3p0-specific configuration settings are recognized in addition to the general ones described in <>. Transaction isolation of the Connections is managed by the `ConnectionProvider` itself. See <>. -`hibernate.c3p0.min_size` or `c3p0.minPoolSize`:: The minimum size of the c3p0 pool. See http://www.mchange.com/projects/c3p0/#minPoolSize[c3p0 minPoolSize] -`hibernate.c3p0.max_size` or `c3p0.maxPoolSize`:: The maximum size of the c3p0 pool. See http://www.mchange.com/projects/c3p0/#maxPoolSize[c3p0 maxPoolSize] -`hibernate.c3p0.timeout` or `c3p0.maxIdleTime`:: The Connection idle time. See http://www.mchange.com/projects/c3p0/#maxIdleTime[c3p0 maxIdleTime] -`hibernate.c3p0.max_statements` or `c3p0.maxStatements`:: Controls the c3p0 PreparedStatement cache size (if using). See http://www.mchange.com/projects/c3p0/#maxStatements[c3p0 maxStatements] -`hibernate.c3p0.acquire_increment` or `c3p0.acquireIncrement`:: Number of connections c3p0 should acquire at a time when the pool is exhausted. See http://www.mchange.com/projects/c3p0/#acquireIncrement[c3p0 acquireIncrement] -`hibernate.c3p0.idle_test_period` or `c3p0.idleConnectionTestPeriod`:: Idle time before a c3p0 pooled connection is validated. See http://www.mchange.com/projects/c3p0/#idleConnectionTestPeriod[c3p0 idleConnectionTestPeriod] -`hibernate.c3p0.initialPoolSize`:: The initial c3p0 pool size. If not specified, default is to use the min pool size. See http://www.mchange.com/projects/c3p0/#initialPoolSize[c3p0 initialPoolSize] +`hibernate.c3p0.min_size` or `c3p0.minPoolSize`:: The minimum size of the c3p0 pool. See https://www.mchange.com/projects/c3p0/#minPoolSize[c3p0 minPoolSize] +`hibernate.c3p0.max_size` or `c3p0.maxPoolSize`:: The maximum size of the c3p0 pool. See https://www.mchange.com/projects/c3p0/#maxPoolSize[c3p0 maxPoolSize] +`hibernate.c3p0.timeout` or `c3p0.maxIdleTime`:: The Connection idle time. See https://www.mchange.com/projects/c3p0/#maxIdleTime[c3p0 maxIdleTime] +`hibernate.c3p0.max_statements` or `c3p0.maxStatements`:: Controls the c3p0 PreparedStatement cache size (if using). See https://www.mchange.com/projects/c3p0/#maxStatements[c3p0 maxStatements] +`hibernate.c3p0.acquire_increment` or `c3p0.acquireIncrement`:: Number of connections c3p0 should acquire at a time when the pool is exhausted. See https://www.mchange.com/projects/c3p0/#acquireIncrement[c3p0 acquireIncrement] +`hibernate.c3p0.idle_test_period` or `c3p0.idleConnectionTestPeriod`:: Idle time before a c3p0 pooled connection is validated. See https://www.mchange.com/projects/c3p0/#idleConnectionTestPeriod[c3p0 idleConnectionTestPeriod] +`hibernate.c3p0.initialPoolSize`:: The initial c3p0 pool size. If not specified, default is to use the min pool size. See https://www.mchange.com/projects/c3p0/#initialPoolSize[c3p0 initialPoolSize] Any other settings prefixed with `hibernate.c3p0.`:: Will have the `hibernate.` portion stripped and be passed to c3p0. -Any other settings prefixed with `c3p0.`:: Get passed to c3p0 as is. See http://www.mchange.com/projects/c3p0/#configuration[c3p0 configuration] +Any other settings prefixed with `c3p0.`:: Get passed to c3p0 as is. See https://www.mchange.com/projects/c3p0/#configuration[c3p0 configuration] [[database-connectionprovider-proxool]] === Using Proxool @@ -78,7 +78,7 @@ Any other settings prefixed with `c3p0.`:: Get passed to c3p0 as is. See http:// To use the Proxool integration, the application must include the `hibernate-proxool` module jar (as well as its dependencies) on the classpath. ==== -Hibernate also provides support for applications to use http://proxool.sourceforge.net/[Proxool] connection pooling. +Hibernate also provides support for applications to use https://proxool.sourceforge.net/[Proxool] connection pooling. Transaction isolation of the Connections is managed by the `ConnectionProvider` itself. See <>. @@ -92,14 +92,14 @@ If set to true, this ConnectionProvider will use an already existing Proxool poo ==== Configuring Proxool via XML The `hibernate.proxool.xml` setting names a Proxool configuration XML file to be loaded as a classpath resource and loaded by Proxool's JAXPConfigurator. -See http://proxool.sourceforge.net/configure.html[proxool configuration]. +See https://proxool.sourceforge.net/configure.html[proxool configuration]. `hibernate.proxool.pool_alias` must be set to indicate which pool to use. [[database-connectionprovider-proxool-properties]] ==== Configuring Proxool via Properties The `hibernate.proxool.properties` setting names a Proxool configuration properties file to be loaded as a classpath resource and loaded by Proxool's `PropertyConfigurator`. -See http://proxool.sourceforge.net/configure.html[proxool configuration]. +See https://proxool.sourceforge.net/configure.html[proxool configuration]. `hibernate.proxool.pool_alias` must be set to indicate which pool to use. [[database-connectionprovider-hikari]] @@ -131,7 +131,7 @@ Note that Hikari only supports JDBC standard isolation levels (apparently). To use the Vibur DBCP integration, the application must include the `hibernate-vibur` module jar (as well as its dependencies) on the classpath. ==== -Hibernate also provides support for applications to use http://www.vibur.org/[Vibur DBCP] connection pool. +Hibernate also provides support for applications to use https://www.vibur.org/[Vibur DBCP] connection pool. Set all of your Vibur settings in Hibernate prefixed by `hibernate.vibur.` and this `ConnectionProvider` will pick them up and pass them along to Vibur DBCP. Additionally, this `ConnectionProvider` will pick up the following Hibernate-specific properties and map them to the corresponding Vibur ones (any `hibernate.vibur.` prefixed ones have precedence): @@ -151,7 +151,7 @@ Additionally, this `ConnectionProvider` will pick up the following Hibernate-spe To use the Agroal integration, the application must include the `hibernate-agroal` module jar (as well as its dependencies) on the classpath. ==== -Hibernate also provides support for applications to use http://agroal.github.io/[Agroal] connection pool. +Hibernate also provides support for applications to use https://agroal.github.io/[Agroal] connection pool. Set all of your Agroal settings in Hibernate prefixed by `hibernate.agroal.` and this `ConnectionProvider` will pick them up and pass them along to Agroal connection pool. Additionally, this `ConnectionProvider` will pick up the following Hibernate-specific properties and map them to the corresponding Agroal ones (any `hibernate.agroal.` prefixed ones have precedence): diff --git a/documentation/src/main/asciidoc/userguide/chapters/locking/Locking.adoc b/documentation/src/main/asciidoc/userguide/chapters/locking/Locking.adoc index 7784ce31c6..c887753759 100644 --- a/documentation/src/main/asciidoc/userguide/chapters/locking/Locking.adoc +++ b/documentation/src/main/asciidoc/userguide/chapters/locking/Locking.adoc @@ -8,7 +8,7 @@ In a relational database, locking refers to actions taken to prevent data from c Your locking strategy can be either optimistic or pessimistic. Optimistic:: -http://en.wikipedia.org/wiki/Optimistic_locking[Optimistic locking] assumes that multiple transactions can complete without affecting each other, +https://en.wikipedia.org/wiki/Optimistic_locking[Optimistic locking] assumes that multiple transactions can complete without affecting each other, and that therefore transactions can proceed without locking the data resources that they affect. Before committing, each transaction verifies that no other transaction has modified its data. If the check reveals conflicting modifications, the committing transaction rolls back. diff --git a/documentation/src/main/asciidoc/userguide/chapters/portability/Portability.adoc b/documentation/src/main/asciidoc/userguide/chapters/portability/Portability.adoc index 1e8cf2fed1..298d7d9726 100644 --- a/documentation/src/main/asciidoc/userguide/chapters/portability/Portability.adoc +++ b/documentation/src/main/asciidoc/userguide/chapters/portability/Portability.adoc @@ -66,7 +66,7 @@ Hibernate was changed slightly, once the implications of this were better unders The underlying issue is that the actual semantics of the application itself changes in these cases. ==== -Starting with version 3.2.3, Hibernate comes with a set of http://in.relation.to/2082.lace[enhanced] identifier generators targeting portability in a much different way. +Starting with version 3.2.3, Hibernate comes with a set of https://in.relation.to/2082.lace[enhanced] identifier generators targeting portability in a much different way. [NOTE] ==== diff --git a/documentation/src/main/asciidoc/userguide/chapters/query/hql/HQL.adoc b/documentation/src/main/asciidoc/userguide/chapters/query/hql/HQL.adoc index 2e8fc345e4..69706a7f32 100644 --- a/documentation/src/main/asciidoc/userguide/chapters/query/hql/HQL.adoc +++ b/documentation/src/main/asciidoc/userguide/chapters/query/hql/HQL.adoc @@ -909,7 +909,7 @@ include::{extrasdir}/hql-distinct-entity-query-example.sql[] ---- ==== -In this case, the `DISTINCT` SQL keyword is undesirable since it does a redundant result set sorting, as explained http://in.relation.to/2016/08/04/introducing-distinct-pass-through-query-hint/[in this blog post]. +In this case, the `DISTINCT` SQL keyword is undesirable since it does a redundant result set sorting, as explained https://in.relation.to/2016/08/04/introducing-distinct-pass-through-query-hint/[in this blog post]. To fix this issue, Hibernate 5.2.2 added support for the `HINT_PASS_DISTINCT_THROUGH` entity query hint: [[hql-distinct-entity-query-hint-example]] diff --git a/documentation/src/main/asciidoc/userguide/chapters/query/spatial/Spatial.adoc b/documentation/src/main/asciidoc/userguide/chapters/query/spatial/Spatial.adoc index 578048ac4d..2baffcb434 100644 --- a/documentation/src/main/asciidoc/userguide/chapters/query/spatial/Spatial.adoc +++ b/documentation/src/main/asciidoc/userguide/chapters/query/spatial/Spatial.adoc @@ -15,13 +15,13 @@ It supports most of the functions described by the OGC Simple Feature Specificat PostgreSQL/PostGIS, MySQL, Microsoft SQL Server and H2/GeoDB. Spatial data types are not part of the Java standard library, and they are absent from the JDBC specification. -Over the years http://tsusiatsoftware.net/jts/main.html[JTS] has emerged the _de facto_ standard to fill this gap. JTS is +Over the years https://tsusiatsoftware.net/jts/main.html[JTS] has emerged the _de facto_ standard to fill this gap. JTS is an implementation of the https://portal.opengeospatial.org/files/?artifact_id=829[Simple Feature Specification (SFS)]. Many databases on the other hand implement the SQL/MM - Part 3: Spatial Data specification - a related, but broader specification. The biggest difference is that SFS is limited to 2D geometries in the projected plane (although JTS supports 3D coordinates), whereas SQL/MM supports 2-, 3- or 4-dimensional coordinate spaces. -Hibernate Spatial supports two different geometry models: http://tsusiatsoftware.net/jts/main.html[JTS] and +Hibernate Spatial supports two different geometry models: https://tsusiatsoftware.net/jts/main.html[JTS] and https://github.com/GeoLatte/geolatte-geom[geolatte-geom]. As already mentioned, JTS is the _de facto_ standard. Geolatte-geom (also written by the lead developer of Hibernate Spatial) is a more recent library that supports many features specified in SQL/MM but not available in JTS (such as support for 4D geometries, and support for extended WKT/WKB formats). diff --git a/documentation/src/main/asciidoc/userguide/chapters/transactions/Transactions.adoc b/documentation/src/main/asciidoc/userguide/chapters/transactions/Transactions.adoc index ef2aae6b71..3f00ebd657 100644 --- a/documentation/src/main/asciidoc/userguide/chapters/transactions/Transactions.adoc +++ b/documentation/src/main/asciidoc/userguide/chapters/transactions/Transactions.adoc @@ -40,7 +40,7 @@ or provide a custom `org.hibernate.resource.transaction.TransactionCoordinatorBu [NOTE] ==== For details on implementing a custom `TransactionCoordinatorBuilder`, or simply better understanding how it works, see the -http://docs.jboss.org/hibernate/orm/{majorMinorVersion}/integrationguide/html_single/Hibernate_Integration_Guide.html[Integration Guide] . +https://docs.jboss.org/hibernate/orm/{majorMinorVersion}/integrationguide/html_single/Hibernate_Integration_Guide.html[Integration Guide] . ==== Hibernate uses JDBC connections and JTA resources directly, without adding any additional locking behavior. diff --git a/gradle/published-java-module.gradle b/gradle/published-java-module.gradle index cfee264828..df0fd448b2 100644 --- a/gradle/published-java-module.gradle +++ b/gradle/published-java-module.gradle @@ -24,7 +24,7 @@ jar { 'Implementation-Version': project.version, 'Implementation-Vendor': 'Hibernate.org', 'Implementation-Vendor-Id': 'org.hibernate', - 'Implementation-Url': 'http://hibernate.org/orm', + 'Implementation-Url': 'https://hibernate.org/orm', // Java 9 module name 'Automatic-Module-Name': project.java9ModuleName, @@ -37,7 +37,7 @@ jar { 'Bundle-Name': project.name, 'Bundle-SymbolicName': project.java9ModuleName, 'Bundle-Vendor': 'Hibernate.org', - 'Bundle-DocURL': "http://www.hibernate.org/orm/${project.ormVersion.family}", + 'Bundle-DocURL': "https://hibernate.org/orm/${project.ormVersion.family}", // This is overridden in some sub-projects 'Import-Package': [ // Temporarily support JTA 1.1 -- Karaf and other frameworks still @@ -65,7 +65,7 @@ task sourcesJar(type: Jar) { 'Implementation-Version': project.version, 'Implementation-Vendor': 'Hibernate.org', 'Implementation-Vendor-Id': 'org.hibernate', - 'Implementation-Url': 'http://hibernate.org/orm', + 'Implementation-Url': 'https://hibernate.org/orm', // Hibernate-specific JAR manifest attributes 'Hibernate-VersionFamily': project.ormVersion.family, @@ -87,7 +87,7 @@ task javadocJar(type: Jar) { 'Implementation-Version': project.version, 'Implementation-Vendor': 'Hibernate.org', 'Implementation-Vendor-Id': 'org.hibernate', - 'Implementation-Url': 'http://hibernate.org/orm', + 'Implementation-Url': 'https://hibernate.org/orm', // Hibernate-specific JAR manifest attributes 'Hibernate-VersionFamily': project.ormVersion.family, @@ -110,13 +110,13 @@ javadoc { configure( options ) { windowTitle = "$project.name JavaDocs" docTitle = "$project.name JavaDocs ($project.version)" - bottom = "Copyright © 2001-$currentYear Red Hat, Inc. All Rights Reserved." + bottom = "Copyright © 2001-$currentYear Red Hat, Inc. All Rights Reserved." use = true encoding = 'UTF-8' links += [ 'https://docs.oracle.com/javase/8/docs/api/', - 'http://docs.jboss.org/hibernate/beanvalidation/spec/2.0/api/', - 'http://docs.jboss.org/cdi/api/2.0/', + 'https://docs.jboss.org/hibernate/beanvalidation/spec/2.0/api/', + 'https://docs.jboss.org/cdi/api/2.0/', 'https://javaee.github.io/javaee-spec/javadocs/' ] tags = [ "apiNote", 'implSpec', 'implNote', 'todo' ] diff --git a/gradle/publishing-pom.gradle b/gradle/publishing-pom.gradle index eb3e94d4c6..8179f34591 100644 --- a/gradle/publishing-pom.gradle +++ b/gradle/publishing-pom.gradle @@ -20,25 +20,25 @@ publishing { pom { name = 'Hibernate ORM - ' + project.name description = project.description - url = 'http://hibernate.org/orm' + url = 'https://hibernate.org/orm' organization { name = 'Hibernate.org' - url = 'http://hibernate.org' + url = 'https://hibernate.org' } licenses { license { name = 'GNU Library General Public License v2.1 or later' - url = 'http://www.opensource.org/licenses/LGPL-2.1' - comments = 'See discussion at http://hibernate.org/community/license/ for more details.' + url = 'https://www.opensource.org/licenses/LGPL-2.1' + comments = 'See discussion at https://hibernate.org/community/license/ for more details.' distribution = 'repo' } } scm { - url = 'http://github.com/hibernate/hibernate-orm' - connection = 'scm:git:http://github.com/hibernate/hibernate-orm.git' + url = 'https://github.com/hibernate/hibernate-orm' + connection = 'scm:git:https://github.com/hibernate/hibernate-orm.git' developerConnection = 'scm:git:git@github.com:hibernate/hibernate-orm.git' } @@ -52,7 +52,7 @@ publishing { id = 'hibernate-team' name = 'The Hibernate Development Team' organization = 'Hibernate.org' - organizationUrl = 'http://hibernate.org' + organizationUrl = 'https://hibernate.org' } } From 5df5ddbe3ad0d68a14f34f89a54f79d6d2cf51d2 Mon Sep 17 00:00:00 2001 From: Christian Beikov Date: Fri, 4 Jun 2021 13:32:23 +0200 Subject: [PATCH 16/16] Remove obsolete JPA 3.0 TCK build arg --- ci/jpa-3.0-tck.Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/jpa-3.0-tck.Jenkinsfile b/ci/jpa-3.0-tck.Jenkinsfile index 03ea505159..3d1aab779c 100644 --- a/ci/jpa-3.0-tck.Jenkinsfile +++ b/ci/jpa-3.0-tck.Jenkinsfile @@ -36,7 +36,7 @@ pipeline { dir('tck') { checkout changelog: false, poll: false, scm: [$class: 'GitSCM', branches: [[name: '*/main']], extensions: [], userRemoteConfigs: [[url: 'https://github.com/hibernate/jakarta-tck-runner.git']]] sh """ \ - cd jpa-3.0; docker build -f Dockerfile.${params.IMAGE_JDK} -t jakarta-tck-runner --build-arg JDK_IMAGE=${params.BASE_IMAGE} --build-arg TCK_VERSION=${params.TCK_VERSION} --build-arg TCK_SHA=${params.TCK_SHA} . + cd jpa-3.0; docker build -f Dockerfile.${params.IMAGE_JDK} -t jakarta-tck-runner --build-arg TCK_VERSION=${params.TCK_VERSION} --build-arg TCK_SHA=${params.TCK_SHA} . """ } }