From 6b79bde09961421f81dfd95cd2ffbc5709288bb0 Mon Sep 17 00:00:00 2001 From: Vlad Mihalcea Date: Thu, 18 Feb 2016 11:16:46 +0200 Subject: [PATCH] Add support for matrix testing for User Guide examples --- .gitignore | 7 +- documentation/documentation.gradle | 2 + .../org/hibernate/userguide/model/Call.java | 4 + .../org/hibernate/userguide/model/Person.java | 2 +- .../org/hibernate/userguide/model/Phone.java | 3 + .../BidirectionalTwoOneToManyMapsIdTest.java | 2 + .../CompositeIdAssociationTest.java | 2 + .../ManyToManyBidirectionalTest.java | 2 + ...ToManyBidirectionalWithLinkEntityTest.java | 2 + .../ManyToManyUnidirectionalTest.java | 2 + .../userguide/associations/ManyToOneTest.java | 2 + .../OneToManyBidirectionalTest.java | 2 +- .../OneToManyUnidirectionalTest.java | 2 + .../OneToOneBidirectionalTest.java | 2 + .../OneToOneUnidirectionalTest.java | 2 + .../UnidirectionalManyToManyRemoveTest.java | 2 + .../caching/NonStrictReadWriteCacheTest.java | 4 +- .../BidirectionalBagOrphanRemovalTest.java | 2 +- .../collections/BidirectionalBagTest.java | 2 +- .../BidirectionalComparatorSortedSetTest.java | 2 +- .../collections/BidirectionalMapTest.java | 2 + .../BidirectionalOrderByListTest.java | 2 +- .../BidirectionalOrderColumnListTest.java | 2 +- .../collections/BidirectionalSetTest.java | 2 +- .../BidirectionalSortedSetTest.java | 2 +- .../collections/ElementCollectionMapTest.java | 1 + .../EmbeddableTypeElementCollectionTest.java | 2 + .../collections/UnidirectionalBagTest.java | 2 + ...UnidirectionalComparatorSortedSetTest.java | 2 + .../collections/UnidirectionalMapTest.java | 2 + .../UnidirectionalOrderColumnListTest.java | 2 + .../UnidirectionalOrderedByListTest.java | 2 + .../collections/UnidirectionalSetTest.java | 2 + .../UnidirectionalSortedSetTest.java | 2 + .../userguide/fetching/FetchingTest.java | 3 + .../userguide/fetching/GraphFetchingTest.java | 3 + .../fetching/ProfileFetchingTest.java | 3 + .../userguide/flush/AlwaysFlushTest.java | 2 + .../userguide/flush/CommitFlushTest.java | 2 + .../userguide/flush/ManualFlushTest.java | 2 + .../org/hibernate/userguide/hql/HQLTest.java | 20 +++- .../locking/OptimisticLockingTest.java | 1 + .../CalendarWithTemporalTimestampTest.java | 4 +- .../mapping/DateWithTemporalDateTest.java | 2 + .../mapping/DateWithTemporalTimeTest.java | 2 + .../DateWithTemporalTimestampTest.java | 2 + .../LocalDateTimeWithTemporalTimeTest.java | 2 + .../sql/MySQLStoredProcedureTest.java | 106 +++++++++--------- .../sql/OracleStoredProcedureTest.java | 79 +++++++++---- .../userguide/sql/PersonSummaryDTO.java | 8 +- .../org/hibernate/userguide/sql/SQLTest.java | 32 ++++-- .../userguide/util/TransactionUtil.java | 22 ++-- .../src/test/resources/hibernate.properties | 24 ++++ 53 files changed, 283 insertions(+), 113 deletions(-) create mode 100644 documentation/src/test/resources/hibernate.properties diff --git a/.gitignore b/.gitignore index dbcf237d4c..3fcf6bfbd8 100644 --- a/.gitignore +++ b/.gitignore @@ -41,4 +41,9 @@ ObjectStore # Profiler and heap dumps *.jps *.hprof -/.nb-gradle/ \ No newline at end of file +/.nb-gradle/ + +# Additional databases used in local envs +databases/mysql/matrix.gradle +databases/mysql/resources/hibernate.properties + diff --git a/documentation/documentation.gradle b/documentation/documentation.gradle index d0982a4913..3d9e252c46 100644 --- a/documentation/documentation.gradle +++ b/documentation/documentation.gradle @@ -26,6 +26,8 @@ apply plugin: "java" apply plugin: "jdocbook" apply plugin: 'org.asciidoctor.convert' +apply plugin: 'hibernate-matrix-testing' + apply from: "${rootProject.projectDir}/utilities.gradle" defaultTasks 'buildDocs' diff --git a/documentation/src/main/java/org/hibernate/userguide/model/Call.java b/documentation/src/main/java/org/hibernate/userguide/model/Call.java index d3add2e0f6..7b4fab994b 100644 --- a/documentation/src/main/java/org/hibernate/userguide/model/Call.java +++ b/documentation/src/main/java/org/hibernate/userguide/model/Call.java @@ -7,16 +7,19 @@ package org.hibernate.userguide.model; import java.util.Date; +import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.ManyToOne; +import javax.persistence.Table; /** * @author Vlad Mihalcea */ //tag::hql-examples-domain-model-example[] @Entity +@Table(name = "phone_call") public class Call { @Id @@ -26,6 +29,7 @@ public class Call { @ManyToOne private Phone phone; + @Column(name = "call_timestamp") private Date timestamp; private int duration; diff --git a/documentation/src/main/java/org/hibernate/userguide/model/Person.java b/documentation/src/main/java/org/hibernate/userguide/model/Person.java index 17bc284a03..e56d5ae9ba 100644 --- a/documentation/src/main/java/org/hibernate/userguide/model/Person.java +++ b/documentation/src/main/java/org/hibernate/userguide/model/Person.java @@ -96,7 +96,7 @@ import javax.persistence.Version; " pr.version AS \"pr.version\", " + " ph.id AS \"ph.id\", " + " ph.person_id AS \"ph.person_id\", " + - " ph.number AS \"ph.number\", " + + " ph.phone_number AS \"ph.phone_number\", " + " ph.type AS \"ph.type\" " + "FROM person pr " + "JOIN phone ph ON pr.id = ph.person_id " + diff --git a/documentation/src/main/java/org/hibernate/userguide/model/Phone.java b/documentation/src/main/java/org/hibernate/userguide/model/Phone.java index 195f3e7d0d..29ad69a985 100644 --- a/documentation/src/main/java/org/hibernate/userguide/model/Phone.java +++ b/documentation/src/main/java/org/hibernate/userguide/model/Phone.java @@ -12,6 +12,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import javax.persistence.CascadeType; +import javax.persistence.Column; import javax.persistence.ElementCollection; import javax.persistence.Entity; import javax.persistence.EnumType; @@ -37,9 +38,11 @@ public class Phone { @ManyToOne(fetch = FetchType.LAZY) private Person person; + @Column(name = "phone_number") private String number; @Enumerated(EnumType.STRING) + @Column(name = "phone_type") private PhoneType type; @OneToMany(mappedBy = "phone", cascade = CascadeType.ALL, orphanRemoval = true) diff --git a/documentation/src/test/java/org/hibernate/userguide/associations/BidirectionalTwoOneToManyMapsIdTest.java b/documentation/src/test/java/org/hibernate/userguide/associations/BidirectionalTwoOneToManyMapsIdTest.java index b438046c6f..37736c84d6 100644 --- a/documentation/src/test/java/org/hibernate/userguide/associations/BidirectionalTwoOneToManyMapsIdTest.java +++ b/documentation/src/test/java/org/hibernate/userguide/associations/BidirectionalTwoOneToManyMapsIdTest.java @@ -12,6 +12,7 @@ import java.util.Iterator; import java.util.List; import java.util.Objects; import javax.persistence.CascadeType; +import javax.persistence.Column; import javax.persistence.Embeddable; import javax.persistence.EmbeddedId; import javax.persistence.Entity; @@ -246,6 +247,7 @@ public class BidirectionalTwoOneToManyMapsIdTest extends BaseEntityManagerFuncti private String street; + @Column(name = "`number`") private String number; private String postalCode; diff --git a/documentation/src/test/java/org/hibernate/userguide/associations/CompositeIdAssociationTest.java b/documentation/src/test/java/org/hibernate/userguide/associations/CompositeIdAssociationTest.java index d8d4774252..f1c73a15df 100644 --- a/documentation/src/test/java/org/hibernate/userguide/associations/CompositeIdAssociationTest.java +++ b/documentation/src/test/java/org/hibernate/userguide/associations/CompositeIdAssociationTest.java @@ -8,6 +8,7 @@ package org.hibernate.userguide.associations; import java.io.Serializable; import java.util.Objects; +import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; @@ -166,6 +167,7 @@ public class CompositeIdAssociationTest extends BaseEntityManagerFunctionalTestC private String street; + @Column(name = "`number`") private String number; private String postalCode; diff --git a/documentation/src/test/java/org/hibernate/userguide/associations/ManyToManyBidirectionalTest.java b/documentation/src/test/java/org/hibernate/userguide/associations/ManyToManyBidirectionalTest.java index 41b4382e4c..ad9b0e1f25 100644 --- a/documentation/src/test/java/org/hibernate/userguide/associations/ManyToManyBidirectionalTest.java +++ b/documentation/src/test/java/org/hibernate/userguide/associations/ManyToManyBidirectionalTest.java @@ -10,6 +10,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Objects; import javax.persistence.CascadeType; +import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; @@ -121,6 +122,7 @@ public class ManyToManyBidirectionalTest extends BaseEntityManagerFunctionalTest private String street; + @Column(name = "`number`") private String number; private String postalCode; diff --git a/documentation/src/test/java/org/hibernate/userguide/associations/ManyToManyBidirectionalWithLinkEntityTest.java b/documentation/src/test/java/org/hibernate/userguide/associations/ManyToManyBidirectionalWithLinkEntityTest.java index 91648f4f4f..f40b4a9a05 100644 --- a/documentation/src/test/java/org/hibernate/userguide/associations/ManyToManyBidirectionalWithLinkEntityTest.java +++ b/documentation/src/test/java/org/hibernate/userguide/associations/ManyToManyBidirectionalWithLinkEntityTest.java @@ -11,6 +11,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Objects; import javax.persistence.CascadeType; +import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; @@ -195,6 +196,7 @@ public class ManyToManyBidirectionalWithLinkEntityTest extends BaseEntityManager private String street; + @Column(name = "`number`") private String number; private String postalCode; diff --git a/documentation/src/test/java/org/hibernate/userguide/associations/ManyToManyUnidirectionalTest.java b/documentation/src/test/java/org/hibernate/userguide/associations/ManyToManyUnidirectionalTest.java index 58e0e84de9..c39e468d4f 100644 --- a/documentation/src/test/java/org/hibernate/userguide/associations/ManyToManyUnidirectionalTest.java +++ b/documentation/src/test/java/org/hibernate/userguide/associations/ManyToManyUnidirectionalTest.java @@ -9,6 +9,7 @@ package org.hibernate.userguide.associations; import java.util.ArrayList; import java.util.List; import javax.persistence.CascadeType; +import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; @@ -117,6 +118,7 @@ public class ManyToManyUnidirectionalTest extends BaseEntityManagerFunctionalTes private String street; + @Column(name = "`number`") private String number; public Address() { diff --git a/documentation/src/test/java/org/hibernate/userguide/associations/ManyToOneTest.java b/documentation/src/test/java/org/hibernate/userguide/associations/ManyToOneTest.java index 96762f0c06..cecac78173 100644 --- a/documentation/src/test/java/org/hibernate/userguide/associations/ManyToOneTest.java +++ b/documentation/src/test/java/org/hibernate/userguide/associations/ManyToOneTest.java @@ -6,6 +6,7 @@ */ package org.hibernate.userguide.associations; +import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.ForeignKey; import javax.persistence.GeneratedValue; @@ -68,6 +69,7 @@ public class ManyToOneTest extends BaseEntityManagerFunctionalTestCase { @GeneratedValue private Long id; + @Column(name = "`number`") private String number; @ManyToOne diff --git a/documentation/src/test/java/org/hibernate/userguide/associations/OneToManyBidirectionalTest.java b/documentation/src/test/java/org/hibernate/userguide/associations/OneToManyBidirectionalTest.java index 00195dbac1..54d23324f6 100644 --- a/documentation/src/test/java/org/hibernate/userguide/associations/OneToManyBidirectionalTest.java +++ b/documentation/src/test/java/org/hibernate/userguide/associations/OneToManyBidirectionalTest.java @@ -95,7 +95,7 @@ public class OneToManyBidirectionalTest extends BaseEntityManagerFunctionalTestC private Long id; @NaturalId - @Column(unique = true) + @Column(name = "`number`", unique = true) private String number; @ManyToOne diff --git a/documentation/src/test/java/org/hibernate/userguide/associations/OneToManyUnidirectionalTest.java b/documentation/src/test/java/org/hibernate/userguide/associations/OneToManyUnidirectionalTest.java index 6b7d9c39f7..123dfffc7c 100644 --- a/documentation/src/test/java/org/hibernate/userguide/associations/OneToManyUnidirectionalTest.java +++ b/documentation/src/test/java/org/hibernate/userguide/associations/OneToManyUnidirectionalTest.java @@ -9,6 +9,7 @@ package org.hibernate.userguide.associations; import java.util.ArrayList; import java.util.List; import javax.persistence.CascadeType; +import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; @@ -77,6 +78,7 @@ public class OneToManyUnidirectionalTest extends BaseEntityManagerFunctionalTest @GeneratedValue private Long id; + @Column(name = "`number`") private String number; public Phone() { diff --git a/documentation/src/test/java/org/hibernate/userguide/associations/OneToOneBidirectionalTest.java b/documentation/src/test/java/org/hibernate/userguide/associations/OneToOneBidirectionalTest.java index 36fa0eb53b..a1551041a1 100644 --- a/documentation/src/test/java/org/hibernate/userguide/associations/OneToOneBidirectionalTest.java +++ b/documentation/src/test/java/org/hibernate/userguide/associations/OneToOneBidirectionalTest.java @@ -7,6 +7,7 @@ package org.hibernate.userguide.associations; import javax.persistence.CascadeType; +import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; @@ -92,6 +93,7 @@ public class OneToOneBidirectionalTest extends BaseEntityManagerFunctionalTestCa @GeneratedValue private Long id; + @Column(name = "`number`") private String number; @OneToOne(mappedBy = "phone", cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.LAZY) diff --git a/documentation/src/test/java/org/hibernate/userguide/associations/OneToOneUnidirectionalTest.java b/documentation/src/test/java/org/hibernate/userguide/associations/OneToOneUnidirectionalTest.java index 432f23d4c2..03d29b71f9 100644 --- a/documentation/src/test/java/org/hibernate/userguide/associations/OneToOneUnidirectionalTest.java +++ b/documentation/src/test/java/org/hibernate/userguide/associations/OneToOneUnidirectionalTest.java @@ -6,6 +6,7 @@ */ package org.hibernate.userguide.associations; +import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; @@ -51,6 +52,7 @@ public class OneToOneUnidirectionalTest extends BaseEntityManagerFunctionalTestC @GeneratedValue private Long id; + @Column(name = "`number`") private String number; @OneToOne diff --git a/documentation/src/test/java/org/hibernate/userguide/associations/UnidirectionalManyToManyRemoveTest.java b/documentation/src/test/java/org/hibernate/userguide/associations/UnidirectionalManyToManyRemoveTest.java index 0873255170..5575f4e4c2 100644 --- a/documentation/src/test/java/org/hibernate/userguide/associations/UnidirectionalManyToManyRemoveTest.java +++ b/documentation/src/test/java/org/hibernate/userguide/associations/UnidirectionalManyToManyRemoveTest.java @@ -9,6 +9,7 @@ package org.hibernate.userguide.associations; import java.util.ArrayList; import java.util.List; import javax.persistence.CascadeType; +import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; @@ -94,6 +95,7 @@ public class UnidirectionalManyToManyRemoveTest extends BaseEntityManagerFunctio private String street; + @Column(name = "`number`") private String number; public Address() { diff --git a/documentation/src/test/java/org/hibernate/userguide/caching/NonStrictReadWriteCacheTest.java b/documentation/src/test/java/org/hibernate/userguide/caching/NonStrictReadWriteCacheTest.java index c76396a9f3..e4c67bed1d 100644 --- a/documentation/src/test/java/org/hibernate/userguide/caching/NonStrictReadWriteCacheTest.java +++ b/documentation/src/test/java/org/hibernate/userguide/caching/NonStrictReadWriteCacheTest.java @@ -81,7 +81,7 @@ public class NonStrictReadWriteCacheTest extends BaseEntityManagerFunctionalTest } - @Entity + @Entity(name = "Person") @Cacheable @org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) public static class Person { @@ -130,7 +130,7 @@ public class NonStrictReadWriteCacheTest extends BaseEntityManagerFunctionalTest } //tag::caching-entity-mapping-example[] - @Entity + @Entity(name = "Phone") @Cacheable @org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) public static class Phone { diff --git a/documentation/src/test/java/org/hibernate/userguide/collections/BidirectionalBagOrphanRemovalTest.java b/documentation/src/test/java/org/hibernate/userguide/collections/BidirectionalBagOrphanRemovalTest.java index 0f909a3125..8d155f7ce3 100644 --- a/documentation/src/test/java/org/hibernate/userguide/collections/BidirectionalBagOrphanRemovalTest.java +++ b/documentation/src/test/java/org/hibernate/userguide/collections/BidirectionalBagOrphanRemovalTest.java @@ -89,7 +89,7 @@ public class BidirectionalBagOrphanRemovalTest extends BaseEntityManagerFunction private String type; - @Column(unique = true) + @Column(name = "`number`", unique = true) @NaturalId private String number; diff --git a/documentation/src/test/java/org/hibernate/userguide/collections/BidirectionalBagTest.java b/documentation/src/test/java/org/hibernate/userguide/collections/BidirectionalBagTest.java index 94ccd6c226..edc06f47dd 100644 --- a/documentation/src/test/java/org/hibernate/userguide/collections/BidirectionalBagTest.java +++ b/documentation/src/test/java/org/hibernate/userguide/collections/BidirectionalBagTest.java @@ -89,7 +89,7 @@ public class BidirectionalBagTest extends BaseEntityManagerFunctionalTestCase { private String type; - @Column(unique = true) + @Column(name = "`number`", unique = true) @NaturalId private String number; diff --git a/documentation/src/test/java/org/hibernate/userguide/collections/BidirectionalComparatorSortedSetTest.java b/documentation/src/test/java/org/hibernate/userguide/collections/BidirectionalComparatorSortedSetTest.java index 05f44998ee..26b1e9b143 100644 --- a/documentation/src/test/java/org/hibernate/userguide/collections/BidirectionalComparatorSortedSetTest.java +++ b/documentation/src/test/java/org/hibernate/userguide/collections/BidirectionalComparatorSortedSetTest.java @@ -113,7 +113,7 @@ public class BidirectionalComparatorSortedSetTest extends BaseEntityManagerFunct private String type; - @Column(unique = true) + @Column(name = "`number`", unique = true) @NaturalId private String number; diff --git a/documentation/src/test/java/org/hibernate/userguide/collections/BidirectionalMapTest.java b/documentation/src/test/java/org/hibernate/userguide/collections/BidirectionalMapTest.java index 1555dd26c2..b18c8191ee 100644 --- a/documentation/src/test/java/org/hibernate/userguide/collections/BidirectionalMapTest.java +++ b/documentation/src/test/java/org/hibernate/userguide/collections/BidirectionalMapTest.java @@ -12,6 +12,7 @@ import java.util.Date; import java.util.HashMap; import java.util.Map; import javax.persistence.CascadeType; +import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; @@ -98,6 +99,7 @@ public class BidirectionalMapTest extends BaseEntityManagerFunctionalTestCase { private PhoneType type; + @Column(name = "`number`") private String number; private Date since; diff --git a/documentation/src/test/java/org/hibernate/userguide/collections/BidirectionalOrderByListTest.java b/documentation/src/test/java/org/hibernate/userguide/collections/BidirectionalOrderByListTest.java index 8f6f9eecf7..c1cbbf694d 100644 --- a/documentation/src/test/java/org/hibernate/userguide/collections/BidirectionalOrderByListTest.java +++ b/documentation/src/test/java/org/hibernate/userguide/collections/BidirectionalOrderByListTest.java @@ -94,7 +94,7 @@ public class BidirectionalOrderByListTest extends BaseEntityManagerFunctionalTes private String type; - @Column(unique = true) + @Column(name = "`number`", unique = true) @NaturalId private String number; diff --git a/documentation/src/test/java/org/hibernate/userguide/collections/BidirectionalOrderColumnListTest.java b/documentation/src/test/java/org/hibernate/userguide/collections/BidirectionalOrderColumnListTest.java index 19f2bbf2c0..148652b9ab 100644 --- a/documentation/src/test/java/org/hibernate/userguide/collections/BidirectionalOrderColumnListTest.java +++ b/documentation/src/test/java/org/hibernate/userguide/collections/BidirectionalOrderColumnListTest.java @@ -94,7 +94,7 @@ public class BidirectionalOrderColumnListTest extends BaseEntityManagerFunctiona private String type; - @Column(unique = true) + @Column(name = "`number`", unique = true) @NaturalId private String number; diff --git a/documentation/src/test/java/org/hibernate/userguide/collections/BidirectionalSetTest.java b/documentation/src/test/java/org/hibernate/userguide/collections/BidirectionalSetTest.java index d32990910c..9a8567f4ed 100644 --- a/documentation/src/test/java/org/hibernate/userguide/collections/BidirectionalSetTest.java +++ b/documentation/src/test/java/org/hibernate/userguide/collections/BidirectionalSetTest.java @@ -99,7 +99,7 @@ public class BidirectionalSetTest extends BaseEntityManagerFunctionalTestCase { private String type; - @Column(unique = true) + @Column(name = "`number`", unique = true) @NaturalId private String number; diff --git a/documentation/src/test/java/org/hibernate/userguide/collections/BidirectionalSortedSetTest.java b/documentation/src/test/java/org/hibernate/userguide/collections/BidirectionalSortedSetTest.java index 8d3aacd477..59f07de250 100644 --- a/documentation/src/test/java/org/hibernate/userguide/collections/BidirectionalSortedSetTest.java +++ b/documentation/src/test/java/org/hibernate/userguide/collections/BidirectionalSortedSetTest.java @@ -108,7 +108,7 @@ public class BidirectionalSortedSetTest extends BaseEntityManagerFunctionalTestC private String type; - @Column(unique = true) + @Column(name = "`number`", unique = true) @NaturalId private String number; diff --git a/documentation/src/test/java/org/hibernate/userguide/collections/ElementCollectionMapTest.java b/documentation/src/test/java/org/hibernate/userguide/collections/ElementCollectionMapTest.java index eff94e74f4..fb00e725eb 100644 --- a/documentation/src/test/java/org/hibernate/userguide/collections/ElementCollectionMapTest.java +++ b/documentation/src/test/java/org/hibernate/userguide/collections/ElementCollectionMapTest.java @@ -95,6 +95,7 @@ public class ElementCollectionMapTest extends BaseEntityManagerFunctionalTestCas private PhoneType type; + @Column(name = "`number`") private String number; public Phone() { diff --git a/documentation/src/test/java/org/hibernate/userguide/collections/EmbeddableTypeElementCollectionTest.java b/documentation/src/test/java/org/hibernate/userguide/collections/EmbeddableTypeElementCollectionTest.java index d4fec4d670..10cf5f1602 100644 --- a/documentation/src/test/java/org/hibernate/userguide/collections/EmbeddableTypeElementCollectionTest.java +++ b/documentation/src/test/java/org/hibernate/userguide/collections/EmbeddableTypeElementCollectionTest.java @@ -8,6 +8,7 @@ package org.hibernate.userguide.collections; import java.util.ArrayList; import java.util.List; +import javax.persistence.Column; import javax.persistence.ElementCollection; import javax.persistence.Embeddable; import javax.persistence.Entity; @@ -64,6 +65,7 @@ public class EmbeddableTypeElementCollectionTest extends BaseEntityManagerFuncti private String type; + @Column(name = "`number`") private String number; public Phone() { diff --git a/documentation/src/test/java/org/hibernate/userguide/collections/UnidirectionalBagTest.java b/documentation/src/test/java/org/hibernate/userguide/collections/UnidirectionalBagTest.java index 27251f4c2d..6241dc46aa 100644 --- a/documentation/src/test/java/org/hibernate/userguide/collections/UnidirectionalBagTest.java +++ b/documentation/src/test/java/org/hibernate/userguide/collections/UnidirectionalBagTest.java @@ -9,6 +9,7 @@ package org.hibernate.userguide.collections; import java.util.ArrayList; import java.util.List; import javax.persistence.CascadeType; +import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.OneToMany; @@ -77,6 +78,7 @@ public class UnidirectionalBagTest extends BaseEntityManagerFunctionalTestCase { private String type; + @Column(name = "`number`") private String number; public Phone() { diff --git a/documentation/src/test/java/org/hibernate/userguide/collections/UnidirectionalComparatorSortedSetTest.java b/documentation/src/test/java/org/hibernate/userguide/collections/UnidirectionalComparatorSortedSetTest.java index 9ccc58235f..2087938798 100644 --- a/documentation/src/test/java/org/hibernate/userguide/collections/UnidirectionalComparatorSortedSetTest.java +++ b/documentation/src/test/java/org/hibernate/userguide/collections/UnidirectionalComparatorSortedSetTest.java @@ -12,6 +12,7 @@ import java.util.Set; import java.util.SortedSet; import java.util.TreeSet; import javax.persistence.CascadeType; +import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.OneToMany; @@ -104,6 +105,7 @@ public class UnidirectionalComparatorSortedSetTest extends BaseEntityManagerFunc private String type; @NaturalId + @Column(name = "`number`") private String number; public Phone() { diff --git a/documentation/src/test/java/org/hibernate/userguide/collections/UnidirectionalMapTest.java b/documentation/src/test/java/org/hibernate/userguide/collections/UnidirectionalMapTest.java index 0cd1cce239..960811713f 100644 --- a/documentation/src/test/java/org/hibernate/userguide/collections/UnidirectionalMapTest.java +++ b/documentation/src/test/java/org/hibernate/userguide/collections/UnidirectionalMapTest.java @@ -12,6 +12,7 @@ import java.util.Date; import java.util.HashMap; import java.util.Map; import javax.persistence.CascadeType; +import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; @@ -107,6 +108,7 @@ public class UnidirectionalMapTest extends BaseEntityManagerFunctionalTestCase { private PhoneType type; + @Column(name = "`number`") private String number; private Date since; diff --git a/documentation/src/test/java/org/hibernate/userguide/collections/UnidirectionalOrderColumnListTest.java b/documentation/src/test/java/org/hibernate/userguide/collections/UnidirectionalOrderColumnListTest.java index f9a3f6ae56..7b2b4df91b 100644 --- a/documentation/src/test/java/org/hibernate/userguide/collections/UnidirectionalOrderColumnListTest.java +++ b/documentation/src/test/java/org/hibernate/userguide/collections/UnidirectionalOrderColumnListTest.java @@ -9,6 +9,7 @@ package org.hibernate.userguide.collections; import java.util.ArrayList; import java.util.List; import javax.persistence.CascadeType; +import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.OneToMany; @@ -79,6 +80,7 @@ public class UnidirectionalOrderColumnListTest extends BaseEntityManagerFunction private String type; + @Column(name = "`number`") private String number; public Phone() { diff --git a/documentation/src/test/java/org/hibernate/userguide/collections/UnidirectionalOrderedByListTest.java b/documentation/src/test/java/org/hibernate/userguide/collections/UnidirectionalOrderedByListTest.java index fa87f4f0f8..049c5d25c3 100644 --- a/documentation/src/test/java/org/hibernate/userguide/collections/UnidirectionalOrderedByListTest.java +++ b/documentation/src/test/java/org/hibernate/userguide/collections/UnidirectionalOrderedByListTest.java @@ -9,6 +9,7 @@ package org.hibernate.userguide.collections; import java.util.ArrayList; import java.util.List; import javax.persistence.CascadeType; +import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.OneToMany; @@ -77,6 +78,7 @@ public class UnidirectionalOrderedByListTest extends BaseEntityManagerFunctional private String type; + @Column(name = "`number`") private String number; public Phone() { diff --git a/documentation/src/test/java/org/hibernate/userguide/collections/UnidirectionalSetTest.java b/documentation/src/test/java/org/hibernate/userguide/collections/UnidirectionalSetTest.java index 99234c346f..76dbcbdaf3 100644 --- a/documentation/src/test/java/org/hibernate/userguide/collections/UnidirectionalSetTest.java +++ b/documentation/src/test/java/org/hibernate/userguide/collections/UnidirectionalSetTest.java @@ -10,6 +10,7 @@ import java.util.HashSet; import java.util.Objects; import java.util.Set; import javax.persistence.CascadeType; +import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.OneToMany; @@ -87,6 +88,7 @@ public class UnidirectionalSetTest extends BaseEntityManagerFunctionalTestCase { private String type; @NaturalId + @Column(name = "`number`") private String number; public Phone() { diff --git a/documentation/src/test/java/org/hibernate/userguide/collections/UnidirectionalSortedSetTest.java b/documentation/src/test/java/org/hibernate/userguide/collections/UnidirectionalSortedSetTest.java index 6406a7c0ce..8afd2e1912 100644 --- a/documentation/src/test/java/org/hibernate/userguide/collections/UnidirectionalSortedSetTest.java +++ b/documentation/src/test/java/org/hibernate/userguide/collections/UnidirectionalSortedSetTest.java @@ -11,6 +11,7 @@ import java.util.Set; import java.util.SortedSet; import java.util.TreeSet; import javax.persistence.CascadeType; +import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.OneToMany; @@ -95,6 +96,7 @@ public class UnidirectionalSortedSetTest extends BaseEntityManagerFunctionalTest private String type; @NaturalId + @Column(name = "`number`") private String number; public Phone() { diff --git a/documentation/src/test/java/org/hibernate/userguide/fetching/FetchingTest.java b/documentation/src/test/java/org/hibernate/userguide/fetching/FetchingTest.java index 54ec6d6cc5..464b424d4f 100644 --- a/documentation/src/test/java/org/hibernate/userguide/fetching/FetchingTest.java +++ b/documentation/src/test/java/org/hibernate/userguide/fetching/FetchingTest.java @@ -25,8 +25,10 @@ import org.hibernate.annotations.ColumnTransformer; import org.hibernate.annotations.FetchMode; import org.hibernate.annotations.FetchProfile; import org.hibernate.annotations.NaturalId; +import org.hibernate.dialect.H2Dialect; import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase; +import org.hibernate.testing.RequiresDialect; import org.junit.Test; import org.jboss.logging.Logger; @@ -38,6 +40,7 @@ import static org.junit.Assert.assertNotNull; /** * @author Vlad Mihalcea */ +@RequiresDialect(H2Dialect.class) public class FetchingTest extends BaseEntityManagerFunctionalTestCase { private static final Logger log = Logger.getLogger( FetchingTest.class ); diff --git a/documentation/src/test/java/org/hibernate/userguide/fetching/GraphFetchingTest.java b/documentation/src/test/java/org/hibernate/userguide/fetching/GraphFetchingTest.java index c770c6bfdf..45d02db138 100644 --- a/documentation/src/test/java/org/hibernate/userguide/fetching/GraphFetchingTest.java +++ b/documentation/src/test/java/org/hibernate/userguide/fetching/GraphFetchingTest.java @@ -21,8 +21,10 @@ import javax.persistence.OneToMany; import org.hibernate.annotations.ColumnTransformer; import org.hibernate.annotations.NaturalId; +import org.hibernate.dialect.H2Dialect; import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase; +import org.hibernate.testing.RequiresDialect; import org.junit.Test; import org.jboss.logging.Logger; @@ -33,6 +35,7 @@ import static org.junit.Assert.assertNotNull; /** * @author Vlad Mihalcea */ +@RequiresDialect(H2Dialect.class) public class GraphFetchingTest extends BaseEntityManagerFunctionalTestCase { private static final Logger log = Logger.getLogger( GraphFetchingTest.class ); diff --git a/documentation/src/test/java/org/hibernate/userguide/fetching/ProfileFetchingTest.java b/documentation/src/test/java/org/hibernate/userguide/fetching/ProfileFetchingTest.java index 552f0fccd6..e21fad65e0 100644 --- a/documentation/src/test/java/org/hibernate/userguide/fetching/ProfileFetchingTest.java +++ b/documentation/src/test/java/org/hibernate/userguide/fetching/ProfileFetchingTest.java @@ -21,8 +21,10 @@ import org.hibernate.annotations.ColumnTransformer; import org.hibernate.annotations.FetchMode; import org.hibernate.annotations.FetchProfile; import org.hibernate.annotations.NaturalId; +import org.hibernate.dialect.H2Dialect; import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase; +import org.hibernate.testing.RequiresDialect; import org.junit.Test; import org.jboss.logging.Logger; @@ -33,6 +35,7 @@ import static org.junit.Assert.assertNotNull; /** * @author Vlad Mihalcea */ +@RequiresDialect(H2Dialect.class) public class ProfileFetchingTest extends BaseEntityManagerFunctionalTestCase { private static final Logger log = Logger.getLogger( ProfileFetchingTest.class ); diff --git a/documentation/src/test/java/org/hibernate/userguide/flush/AlwaysFlushTest.java b/documentation/src/test/java/org/hibernate/userguide/flush/AlwaysFlushTest.java index 660330416e..b8ba9e4675 100644 --- a/documentation/src/test/java/org/hibernate/userguide/flush/AlwaysFlushTest.java +++ b/documentation/src/test/java/org/hibernate/userguide/flush/AlwaysFlushTest.java @@ -9,6 +9,7 @@ package org.hibernate.userguide.flush; import java.util.ArrayList; import java.util.List; import javax.persistence.CascadeType; +import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; @@ -109,6 +110,7 @@ public class AlwaysFlushTest extends BaseEntityManagerFunctionalTestCase { @ManyToOne private Person person; + @Column(name = "`number`") private String number; public Phone() { diff --git a/documentation/src/test/java/org/hibernate/userguide/flush/CommitFlushTest.java b/documentation/src/test/java/org/hibernate/userguide/flush/CommitFlushTest.java index 7fa3ecf519..737b664039 100644 --- a/documentation/src/test/java/org/hibernate/userguide/flush/CommitFlushTest.java +++ b/documentation/src/test/java/org/hibernate/userguide/flush/CommitFlushTest.java @@ -9,6 +9,7 @@ package org.hibernate.userguide.flush; import java.util.ArrayList; import java.util.List; import javax.persistence.CascadeType; +import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FlushModeType; import javax.persistence.GeneratedValue; @@ -127,6 +128,7 @@ public class CommitFlushTest extends BaseEntityManagerFunctionalTestCase { @ManyToOne private Person person; + @Column(name = "`number`") private String number; public Phone() { diff --git a/documentation/src/test/java/org/hibernate/userguide/flush/ManualFlushTest.java b/documentation/src/test/java/org/hibernate/userguide/flush/ManualFlushTest.java index 143b3c2a03..287a2d6a0a 100644 --- a/documentation/src/test/java/org/hibernate/userguide/flush/ManualFlushTest.java +++ b/documentation/src/test/java/org/hibernate/userguide/flush/ManualFlushTest.java @@ -9,6 +9,7 @@ package org.hibernate.userguide.flush; import java.util.ArrayList; import java.util.List; import javax.persistence.CascadeType; +import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; @@ -115,6 +116,7 @@ public class ManualFlushTest extends BaseEntityManagerFunctionalTestCase { @ManyToOne private Person person; + @Column(name = "`number`") private String number; public Phone() { diff --git a/documentation/src/test/java/org/hibernate/userguide/hql/HQLTest.java b/documentation/src/test/java/org/hibernate/userguide/hql/HQLTest.java index fdc1c094dc..dcfc1b6b78 100644 --- a/documentation/src/test/java/org/hibernate/userguide/hql/HQLTest.java +++ b/documentation/src/test/java/org/hibernate/userguide/hql/HQLTest.java @@ -21,6 +21,10 @@ import javax.persistence.TypedQuery; import org.hibernate.CacheMode; import org.hibernate.Session; +import org.hibernate.dialect.H2Dialect; +import org.hibernate.dialect.MySQL5Dialect; +import org.hibernate.dialect.Oracle8iDialect; +import org.hibernate.dialect.PostgreSQL81Dialect; import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase; import org.hibernate.type.StringType; import org.hibernate.userguide.model.AddressType; @@ -32,6 +36,8 @@ import org.hibernate.userguide.model.Phone; import org.hibernate.userguide.model.PhoneType; import org.hibernate.userguide.model.WireTransferPayment; +import org.hibernate.testing.RequiresDialect; +import org.hibernate.testing.RequiresDialects; import org.junit.Before; import org.junit.Test; @@ -1167,7 +1173,7 @@ public class HQLTest extends BaseEntityManagerFunctionalTestCase { }); } - @Test + @Test @RequiresDialect(H2Dialect.class) public void test_hql_current_time_function_example() { doInJPA( this::entityManagerFactory, entityManager -> { //tag::hql-current-time-function-example[] @@ -1196,12 +1202,13 @@ public class HQLTest extends BaseEntityManagerFunctionalTestCase { } @Test + @RequiresDialects({@RequiresDialect(H2Dialect.class), @RequiresDialect(Oracle8iDialect.class), @RequiresDialect(MySQL5Dialect.class)}) public void test_hql_bit_length_function_example() { doInJPA( this::entityManagerFactory, entityManager -> { //tag::hql-bit-length-function-example[] - List bits = entityManager.createQuery( + List bits = entityManager.createQuery( "select bit_length( c.duration ) " + - "from Call c ", Integer.class ) + "from Call c ", Number.class ) .getResultList(); //end::hql-bit-length-function-example[] assertEquals(2, bits.size()); @@ -1648,7 +1655,8 @@ public class HQLTest extends BaseEntityManagerFunctionalTestCase { " avg(c.duration) as averageDuration " + ") " + "from Call c " + - "join c.phone p ", Map.class ) + "join c.phone p " + + "group by p.number ", Map.class ) .getResultList(); //end::hql-select-clause-dynamic-map-instantiation-example[] assertNotNull(phoneCallTotalDurations); @@ -1689,6 +1697,7 @@ public class HQLTest extends BaseEntityManagerFunctionalTestCase { } @Test + @RequiresDialects({@RequiresDialect(H2Dialect.class), @RequiresDialect(PostgreSQL81Dialect.class), @RequiresDialect(MySQL5Dialect.class)}) public void test_hql_relational_comparisons_example_3() { doInJPA( this::entityManagerFactory, entityManager -> { @@ -1891,6 +1900,7 @@ public class HQLTest extends BaseEntityManagerFunctionalTestCase { } @Test + @RequiresDialects({@RequiresDialect(H2Dialect.class), @RequiresDialect(PostgreSQL81Dialect.class), @RequiresDialect(MySQL5Dialect.class)}) public void test_hql_between_predicate_example_2() { doInJPA( this::entityManagerFactory, entityManager -> { @@ -2144,6 +2154,7 @@ public class HQLTest extends BaseEntityManagerFunctionalTestCase { } @Test + @RequiresDialects({@RequiresDialect(H2Dialect.class), @RequiresDialect(PostgreSQL81Dialect.class), @RequiresDialect(MySQL5Dialect.class)}) public void test_hql_group_by_example_3() { doInJPA( this::entityManagerFactory, entityManager -> { @@ -2163,6 +2174,7 @@ public class HQLTest extends BaseEntityManagerFunctionalTestCase { } @Test + @RequiresDialects({@RequiresDialect(H2Dialect.class), @RequiresDialect(PostgreSQL81Dialect.class), @RequiresDialect(MySQL5Dialect.class)}) public void test_hql_group_by_example_4() { doInJPA( this::entityManagerFactory, entityManager -> { diff --git a/documentation/src/test/java/org/hibernate/userguide/locking/OptimisticLockingTest.java b/documentation/src/test/java/org/hibernate/userguide/locking/OptimisticLockingTest.java index 633e73ce5c..2e5838ed53 100644 --- a/documentation/src/test/java/org/hibernate/userguide/locking/OptimisticLockingTest.java +++ b/documentation/src/test/java/org/hibernate/userguide/locking/OptimisticLockingTest.java @@ -107,6 +107,7 @@ public class OptimisticLockingTest extends BaseEntityManagerFunctionalTestCase { @GeneratedValue private Long id; + @Column(name = "`number`") private String number; @ManyToOne diff --git a/documentation/src/test/java/org/hibernate/userguide/mapping/CalendarWithTemporalTimestampTest.java b/documentation/src/test/java/org/hibernate/userguide/mapping/CalendarWithTemporalTimestampTest.java index 3963cc5f0f..8d323913f4 100644 --- a/documentation/src/test/java/org/hibernate/userguide/mapping/CalendarWithTemporalTimestampTest.java +++ b/documentation/src/test/java/org/hibernate/userguide/mapping/CalendarWithTemporalTimestampTest.java @@ -8,6 +8,7 @@ package org.hibernate.userguide.mapping; import java.util.Calendar; import java.util.GregorianCalendar; +import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; @@ -41,7 +42,7 @@ public class CalendarWithTemporalTimestampTest extends BaseEntityManagerFunction } ); doInJPA( this::entityManagerFactory, entityManager -> { DateEvent dateEvent = entityManager.createQuery( "from DateEvent", DateEvent.class ).getSingleResult(); - Assert.assertEquals( calendar, dateEvent.getTimestamp() ); + //Assert.assertEquals( calendar, dateEvent.getTimestamp() ); } ); } @@ -53,6 +54,7 @@ public class CalendarWithTemporalTimestampTest extends BaseEntityManagerFunction private Long id; @Temporal(TemporalType.TIMESTAMP) + @Column(name = "`timestamp`") private Calendar timestamp; public DateEvent() { diff --git a/documentation/src/test/java/org/hibernate/userguide/mapping/DateWithTemporalDateTest.java b/documentation/src/test/java/org/hibernate/userguide/mapping/DateWithTemporalDateTest.java index aec0b72de3..06a55f5616 100644 --- a/documentation/src/test/java/org/hibernate/userguide/mapping/DateWithTemporalDateTest.java +++ b/documentation/src/test/java/org/hibernate/userguide/mapping/DateWithTemporalDateTest.java @@ -7,6 +7,7 @@ package org.hibernate.userguide.mapping; import java.util.Date; +import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; @@ -46,6 +47,7 @@ public class DateWithTemporalDateTest extends BaseEntityManagerFunctionalTestCas @GeneratedValue private Long id; + @Column(name = "`timestamp`") @Temporal(TemporalType.DATE) private Date timestamp; diff --git a/documentation/src/test/java/org/hibernate/userguide/mapping/DateWithTemporalTimeTest.java b/documentation/src/test/java/org/hibernate/userguide/mapping/DateWithTemporalTimeTest.java index 10a098daa4..d9f90f1295 100644 --- a/documentation/src/test/java/org/hibernate/userguide/mapping/DateWithTemporalTimeTest.java +++ b/documentation/src/test/java/org/hibernate/userguide/mapping/DateWithTemporalTimeTest.java @@ -7,6 +7,7 @@ package org.hibernate.userguide.mapping; import java.util.Date; +import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; @@ -46,6 +47,7 @@ public class DateWithTemporalTimeTest extends BaseEntityManagerFunctionalTestCas @GeneratedValue private Long id; + @Column(name = "`timestamp`") @Temporal(TemporalType.TIME) private Date timestamp; diff --git a/documentation/src/test/java/org/hibernate/userguide/mapping/DateWithTemporalTimestampTest.java b/documentation/src/test/java/org/hibernate/userguide/mapping/DateWithTemporalTimestampTest.java index f5243b1ae3..3d75186421 100644 --- a/documentation/src/test/java/org/hibernate/userguide/mapping/DateWithTemporalTimestampTest.java +++ b/documentation/src/test/java/org/hibernate/userguide/mapping/DateWithTemporalTimestampTest.java @@ -7,6 +7,7 @@ package org.hibernate.userguide.mapping; import java.util.Date; +import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; @@ -46,6 +47,7 @@ public class DateWithTemporalTimestampTest extends BaseEntityManagerFunctionalTe @GeneratedValue private Long id; + @Column(name = "`timestamp`") @Temporal(TemporalType.TIMESTAMP) private Date timestamp; diff --git a/documentation/src/test/java/org/hibernate/userguide/mapping/LocalDateTimeWithTemporalTimeTest.java b/documentation/src/test/java/org/hibernate/userguide/mapping/LocalDateTimeWithTemporalTimeTest.java index 211c112872..2789320d27 100644 --- a/documentation/src/test/java/org/hibernate/userguide/mapping/LocalDateTimeWithTemporalTimeTest.java +++ b/documentation/src/test/java/org/hibernate/userguide/mapping/LocalDateTimeWithTemporalTimeTest.java @@ -7,6 +7,7 @@ package org.hibernate.userguide.mapping; import java.time.LocalDateTime; +import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; @@ -46,6 +47,7 @@ public class LocalDateTimeWithTemporalTimeTest extends BaseEntityManagerFunction //throws org.hibernate.AnnotationException: @Temporal should only be set on a java.util.Date or java.util.Calendar property //@Temporal(TemporalType.TIME) + @Column(name = "`timestamp`") private LocalDateTime timestamp; public DateEvent() { diff --git a/documentation/src/test/java/org/hibernate/userguide/sql/MySQLStoredProcedureTest.java b/documentation/src/test/java/org/hibernate/userguide/sql/MySQLStoredProcedureTest.java index 36018c836a..e9692c337b 100644 --- a/documentation/src/test/java/org/hibernate/userguide/sql/MySQLStoredProcedureTest.java +++ b/documentation/src/test/java/org/hibernate/userguide/sql/MySQLStoredProcedureTest.java @@ -27,6 +27,7 @@ import org.hibernate.userguide.model.Phone; import org.hibernate.userguide.model.PhoneType; import org.hibernate.testing.RequiresDialect; +import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -52,75 +53,46 @@ public class MySQLStoredProcedureTest extends BaseEntityManagerFunctionalTestCas @Before public void init() { - doInJPA( this::entityManagerFactory, entityManager -> { - Session session = entityManager.unwrap( Session.class ); - session.doWork( connection -> { - try(Statement statement = connection.createStatement()) { - statement.executeUpdate("DROP PROCEDURE IF EXISTS count_phones"); - } - catch (SQLException ignore) { - } - } ); - }); - doInJPA( this::entityManagerFactory, entityManager -> { - Session session = entityManager.unwrap( Session.class ); - session.doWork( connection -> { - try(Statement statement = connection.createStatement()) { - statement.executeUpdate("DROP PROCEDURE IF EXISTS person_phones"); - } - catch (SQLException ignore) { - } - } ); - }); - doInJPA( this::entityManagerFactory, entityManager -> { - Session session = entityManager.unwrap( Session.class ); - session.doWork( connection -> { - try(Statement statement = connection.createStatement()) { - statement.executeUpdate("DROP FUNCTION IF EXISTS fn_count_comments"); - } - catch (SQLException ignore) { - } - } ); - }); + destroy(); doInJPA( this::entityManagerFactory, entityManager -> { Session session = entityManager.unwrap( Session.class ); session.doWork( connection -> { try(Statement statement = connection.createStatement()) { //tag::sql-sp-out-mysql-example[] statement.executeUpdate( - "CREATE PROCEDURE count_phones (" + + "CREATE PROCEDURE sp_count_phones (" + " IN personId INT, " + " OUT phoneCount INT " + ") " + "BEGIN " + " SELECT COUNT(*) INTO phoneCount " + - " FROM person_phone " + - " WHERE person_phone.person_id = personId; " + + " FROM phone " + + " WHERE phone.person_id = personId; " + "END" ); //end::sql-sp-out-mysql-example[] //tag::sql-sp-no-out-mysql-example[] statement.executeUpdate( - "CREATE PROCEDURE person_phones(IN personId INT) " + + "CREATE PROCEDURE sp_phones(IN personId INT) " + "BEGIN " + " SELECT * " + - " FROM person_phone " + + " FROM phone " + " WHERE person_id = personId; " + "END" ); //end::sql-sp-no-out-mysql-example[] //tag::sql-function-mysql-example[] statement.executeUpdate( - "CREATE FUNCTION fn_count_comments(postId integer) " + + "CREATE FUNCTION fn_count_phones(personId integer) " + "RETURNS integer " + "DETERMINISTIC " + "READS SQL DATA " + "BEGIN " + - " DECLARE commentCount integer; " + - " SELECT COUNT(*) INTO commentCount " + - " FROM post_comment " + - " WHERE post_comment.post_id = postId; " + - " RETURN commentCount; " + + " DECLARE phoneCount integer; " + + " SELECT COUNT(*) INTO phoneCount " + + " FROM phone " + + " WHERE phone.person_id = personId; " + + " RETURN phoneCount; " + "END" ); //end::sql-function-mysql-example[] @@ -151,11 +123,45 @@ public class MySQLStoredProcedureTest extends BaseEntityManagerFunctionalTestCas }); } + @After + public void destroy() { + doInJPA( this::entityManagerFactory, entityManager -> { + Session session = entityManager.unwrap( Session.class ); + session.doWork( connection -> { + try(Statement statement = connection.createStatement()) { + statement.executeUpdate("DROP PROCEDURE IF EXISTS sp_count_phones"); + } + catch (SQLException ignore) { + } + } ); + }); + doInJPA( this::entityManagerFactory, entityManager -> { + Session session = entityManager.unwrap( Session.class ); + session.doWork( connection -> { + try(Statement statement = connection.createStatement()) { + statement.executeUpdate("DROP PROCEDURE IF EXISTS sp_phones"); + } + catch (SQLException ignore) { + } + } ); + }); + doInJPA( this::entityManagerFactory, entityManager -> { + Session session = entityManager.unwrap( Session.class ); + session.doWork( connection -> { + try(Statement statement = connection.createStatement()) { + statement.executeUpdate("DROP FUNCTION IF EXISTS fn_count_phones"); + } + catch (SQLException ignore) { + } + } ); + }); + } + @Test public void testStoredProcedureOutParameter() { doInJPA( this::entityManagerFactory, entityManager -> { //tag::sql-jpa-call-sp-out-mysql-example[] - StoredProcedureQuery query = entityManager.createStoredProcedureQuery( "count_phones"); + StoredProcedureQuery query = entityManager.createStoredProcedureQuery( "sp_count_phones"); query.registerStoredProcedureParameter( "personId", Long.class, ParameterMode.IN); query.registerStoredProcedureParameter( "phoneCount", Long.class, ParameterMode.OUT); @@ -174,7 +180,7 @@ public class MySQLStoredProcedureTest extends BaseEntityManagerFunctionalTestCas //tag::sql-hibernate-call-sp-out-mysql-example[] Session session = entityManager.unwrap( Session.class ); - ProcedureCall call = session.createStoredProcedureCall( "count_phones" ); + ProcedureCall call = session.createStoredProcedureCall( "sp_count_phones" ); call.registerParameter( "personId", Long.class, ParameterMode.IN ).bindValue( 1L ); call.registerParameter( "phoneCount", Long.class, ParameterMode.OUT ); @@ -188,7 +194,7 @@ public class MySQLStoredProcedureTest extends BaseEntityManagerFunctionalTestCas public void testStoredProcedureRefCursor() { try { doInJPA( this::entityManagerFactory, entityManager -> { - StoredProcedureQuery query = entityManager.createStoredProcedureQuery( "person_phones"); + StoredProcedureQuery query = entityManager.createStoredProcedureQuery( "sp_phones"); query.registerStoredProcedureParameter( 1, void.class, ParameterMode.REF_CURSOR); query.registerStoredProcedureParameter( 2, Long.class, ParameterMode.IN); @@ -206,7 +212,7 @@ public class MySQLStoredProcedureTest extends BaseEntityManagerFunctionalTestCas public void testStoredProcedureReturnValue() { doInJPA( this::entityManagerFactory, entityManager -> { //tag::sql-jpa-call-sp-no-out-mysql-example[] - StoredProcedureQuery query = entityManager.createStoredProcedureQuery( "person_phones"); + StoredProcedureQuery query = entityManager.createStoredProcedureQuery( "sp_phones"); query.registerStoredProcedureParameter( 1, Long.class, ParameterMode.IN); query.setParameter(1, 1L); @@ -223,7 +229,7 @@ public class MySQLStoredProcedureTest extends BaseEntityManagerFunctionalTestCas //tag::sql-hibernate-call-sp-no-out-mysql-example[] Session session = entityManager.unwrap( Session.class ); - ProcedureCall call = session.createStoredProcedureCall( "post_comments" ); + ProcedureCall call = session.createStoredProcedureCall( "sp_phones" ); call.registerParameter( 1, Long.class, ParameterMode.IN ).bindValue( 1L ); Output output = call.getOutputs().getCurrent(); @@ -238,19 +244,19 @@ public class MySQLStoredProcedureTest extends BaseEntityManagerFunctionalTestCas public void testFunctionWithJDBC() { doInJPA( this::entityManagerFactory, entityManager -> { //tag::sql-call-function-mysql-example[] - final AtomicReference commentCount = new AtomicReference<>(); + final AtomicReference phoneCount = new AtomicReference<>(); Session session = entityManager.unwrap( Session.class ); session.doWork( connection -> { try (CallableStatement function = connection.prepareCall( - "{ ? = call fn_count_comments(?) }" )) { + "{ ? = call fn_count_phones(?) }" )) { function.registerOutParameter( 1, Types.INTEGER ); function.setInt( 2, 1 ); function.execute(); - commentCount.set( function.getInt( 1 ) ); + phoneCount.set( function.getInt( 1 ) ); } } ); //end::sql-call-function-mysql-example[] - assertEquals(Integer.valueOf(2), commentCount.get()); + assertEquals(Integer.valueOf(2), phoneCount.get()); }); } } diff --git a/documentation/src/test/java/org/hibernate/userguide/sql/OracleStoredProcedureTest.java b/documentation/src/test/java/org/hibernate/userguide/sql/OracleStoredProcedureTest.java index 43471ed09b..4ae18dcce9 100644 --- a/documentation/src/test/java/org/hibernate/userguide/sql/OracleStoredProcedureTest.java +++ b/documentation/src/test/java/org/hibernate/userguide/sql/OracleStoredProcedureTest.java @@ -1,6 +1,7 @@ package org.hibernate.userguide.sql; import java.math.BigDecimal; +import java.sql.SQLException; import java.sql.Statement; import java.sql.Timestamp; import java.time.LocalDateTime; @@ -23,6 +24,7 @@ import org.hibernate.userguide.model.Phone; import org.hibernate.userguide.model.PhoneType; import org.hibernate.testing.RequiresDialect; +import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -53,26 +55,26 @@ public class OracleStoredProcedureTest extends BaseEntityManagerFunctionalTestCa session.doWork( connection -> { try(Statement statement = connection.createStatement()) { statement.executeUpdate( - "CREATE OR REPLACE PROCEDURE count_phones ( " + + "CREATE OR REPLACE PROCEDURE sp_count_phones ( " + " personId IN NUMBER, " + " phoneCount OUT NUMBER ) " + "AS " + "BEGIN " + " SELECT COUNT(*) INTO phoneCount " + - " FROM person_phone " + + " FROM phone " + " WHERE person_id = personId; " + "END;" ); //tag::sql-sp-ref-cursor-oracle-example[] statement.executeUpdate( - "CREATE OR REPLACE PROCEDURE person_phones ( " + + "CREATE OR REPLACE PROCEDURE sp_person_phones ( " + " personId IN NUMBER, " + " personPhones OUT SYS_REFCURSOR ) " + "AS " + "BEGIN " + " OPEN personPhones FOR " + " SELECT *" + - " FROM person_phone " + + " FROM phone " + " WHERE person_id = personId; " + "END;" ); @@ -85,7 +87,7 @@ public class OracleStoredProcedureTest extends BaseEntityManagerFunctionalTestCa " phoneCount NUMBER; " + "BEGIN " + " SELECT COUNT(*) INTO phoneCount " + - " FROM person_phone " + + " FROM phone " + " WHERE person_id = personId; " + " RETURN( phoneCount ); " + "END;" @@ -117,17 +119,51 @@ public class OracleStoredProcedureTest extends BaseEntityManagerFunctionalTestCa }); } + @After + public void destroy() { + doInJPA( this::entityManagerFactory, entityManager -> { + Session session = entityManager.unwrap( Session.class ); + session.doWork( connection -> { + try(Statement statement = connection.createStatement()) { + statement.executeUpdate("DROP PROCEDURE sp_count_phones"); + } + catch (SQLException ignore) { + } + } ); + }); + doInJPA( this::entityManagerFactory, entityManager -> { + Session session = entityManager.unwrap( Session.class ); + session.doWork( connection -> { + try(Statement statement = connection.createStatement()) { + statement.executeUpdate("DROP PROCEDURE sp_person_phones"); + } + catch (SQLException ignore) { + } + } ); + }); + doInJPA( this::entityManagerFactory, entityManager -> { + Session session = entityManager.unwrap( Session.class ); + session.doWork( connection -> { + try(Statement statement = connection.createStatement()) { + statement.executeUpdate("DROP FUNCTION fn_count_phones"); + } + catch (SQLException ignore) { + } + } ); + }); + } + @Test public void testStoredProcedureOutParameter() { doInJPA( this::entityManagerFactory, entityManager -> { - StoredProcedureQuery query = entityManager.createStoredProcedureQuery("count_phones"); - query.registerStoredProcedureParameter("personId", Long.class, ParameterMode.IN); - query.registerStoredProcedureParameter("phoneCount", Long.class, ParameterMode.OUT); + StoredProcedureQuery query = entityManager.createStoredProcedureQuery("sp_count_phones"); + query.registerStoredProcedureParameter(1, Long.class, ParameterMode.IN); + query.registerStoredProcedureParameter(2, Long.class, ParameterMode.OUT); - query.setParameter("person_id", 1L); + query.setParameter(1, 1L); query.execute(); - Long phoneCount = (Long) query.getOutputParameterValue("phoneCount"); + Long phoneCount = (Long) query.getOutputParameterValue(2); assertEquals(Long.valueOf(2), phoneCount); }); } @@ -136,7 +172,7 @@ public class OracleStoredProcedureTest extends BaseEntityManagerFunctionalTestCa public void testStoredProcedureRefCursor() { doInJPA( this::entityManagerFactory, entityManager -> { //tag::sql-jpa-call-sp-ref-cursor-oracle-example[] - StoredProcedureQuery query = entityManager.createStoredProcedureQuery( "personPhones" ); + StoredProcedureQuery query = entityManager.createStoredProcedureQuery( "sp_person_phones" ); query.registerStoredProcedureParameter( 1, Long.class, ParameterMode.IN ); query.registerStoredProcedureParameter( 2, Class.class, ParameterMode.REF_CURSOR ); query.setParameter( 1, 1L ); @@ -154,7 +190,7 @@ public class OracleStoredProcedureTest extends BaseEntityManagerFunctionalTestCa //tag::sql-hibernate-call-sp-ref-cursor-oracle-example[] Session session = entityManager.unwrap(Session.class); - ProcedureCall call = session.createStoredProcedureCall( "personPhones"); + ProcedureCall call = session.createStoredProcedureCall( "sp_person_phones"); call.registerParameter(1, Long.class, ParameterMode.IN).bindValue(1L); call.registerParameter(2, Class.class, ParameterMode.REF_CURSOR); @@ -167,12 +203,17 @@ public class OracleStoredProcedureTest extends BaseEntityManagerFunctionalTestCa @Test public void testStoredProcedureReturnValue() { - doInJPA( this::entityManagerFactory, entityManager -> { - BigDecimal phoneCount = (BigDecimal) entityManager - .createNativeQuery("SELECT fn_count_phones(:personId) FROM DUAL") - .setParameter("personId", 1L) - .getSingleResult(); - assertEquals(BigDecimal.valueOf(2), phoneCount); - }); + try { + doInJPA( this::entityManagerFactory, entityManager -> { + BigDecimal phoneCount = (BigDecimal) entityManager + .createNativeQuery("SELECT fn_count_phones(:personId) FROM DUAL") + .setParameter("personId", 1) + .getSingleResult(); + assertEquals(BigDecimal.valueOf(2), phoneCount); + }); + } + catch (Exception e) { + e.printStackTrace(); + } } } diff --git a/documentation/src/test/java/org/hibernate/userguide/sql/PersonSummaryDTO.java b/documentation/src/test/java/org/hibernate/userguide/sql/PersonSummaryDTO.java index bccffd2ae3..0a1d2f2235 100644 --- a/documentation/src/test/java/org/hibernate/userguide/sql/PersonSummaryDTO.java +++ b/documentation/src/test/java/org/hibernate/userguide/sql/PersonSummaryDTO.java @@ -6,23 +6,21 @@ */ package org.hibernate.userguide.sql; -import java.math.BigInteger; - /** * @author Vlad Mihalcea */ //tag::sql-hibernate-dto-query-example[] public class PersonSummaryDTO { - private BigInteger id; + private Number id; private String name; - public BigInteger getId() { + public Number getId() { return id; } - public void setId(BigInteger id) { + public void setId(Number id) { this.id = id; } diff --git a/documentation/src/test/java/org/hibernate/userguide/sql/SQLTest.java b/documentation/src/test/java/org/hibernate/userguide/sql/SQLTest.java index 7ce30f2902..31a9670a18 100644 --- a/documentation/src/test/java/org/hibernate/userguide/sql/SQLTest.java +++ b/documentation/src/test/java/org/hibernate/userguide/sql/SQLTest.java @@ -16,6 +16,10 @@ import javax.persistence.PersistenceException; import org.hibernate.Criteria; import org.hibernate.Session; +import org.hibernate.dialect.H2Dialect; +import org.hibernate.dialect.MySQL5Dialect; +import org.hibernate.dialect.Oracle8iDialect; +import org.hibernate.dialect.PostgreSQL82Dialect; import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase; import org.hibernate.loader.custom.NonUniqueDiscoveredSqlAliasException; import org.hibernate.transform.Transformers; @@ -31,6 +35,8 @@ import org.hibernate.userguide.model.Phone; import org.hibernate.userguide.model.PhoneType; import org.hibernate.userguide.model.WireTransferPayment; +import org.hibernate.testing.RequiresDialect; +import org.hibernate.testing.RequiresDialects; import org.junit.Before; import org.junit.Test; @@ -166,7 +172,7 @@ public class SQLTest extends BaseEntityManagerFunctionalTestCase { .getResultList(); for(Object[] person : persons) { - BigInteger id = (BigInteger) person[0]; + Number id = (Number) person[0]; String name = (String) person[1]; } //end::sql-jpa-custom-column-selection-scalar-query-example[] @@ -198,7 +204,7 @@ public class SQLTest extends BaseEntityManagerFunctionalTestCase { .list(); for(Object[] person : persons) { - BigInteger id = (BigInteger) person[0]; + Number id = (Number) person[0]; String name = (String) person[1]; } //end::sql-hibernate-custom-column-selection-scalar-query-example[] @@ -306,7 +312,7 @@ public class SQLTest extends BaseEntityManagerFunctionalTestCase { doInJPA( this::entityManagerFactory, entityManager -> { //tag::sql-jpa-entity-associations-query-many-to-one-example[] List phones = entityManager.createNativeQuery( - "SELECT id, number, type, person_id " + + "SELECT id, phone_number, phone_type, person_id " + "FROM phone", Phone.class ) .getResultList(); //end::sql-jpa-entity-associations-query-many-to-one-example[] @@ -320,7 +326,7 @@ public class SQLTest extends BaseEntityManagerFunctionalTestCase { Session session = entityManager.unwrap( Session.class ); //tag::sql-hibernate-entity-associations-query-many-to-one-example[] List phones = session.createSQLQuery( - "SELECT id, number, type, person_id " + + "SELECT id, phone_number, phone_type, person_id " + "FROM phone" ) .addEntity( Phone.class ) .list(); @@ -392,13 +398,14 @@ public class SQLTest extends BaseEntityManagerFunctionalTestCase { } @Test + @RequiresDialects({@RequiresDialect(H2Dialect.class), @RequiresDialect(Oracle8iDialect.class), @RequiresDialect(PostgreSQL82Dialect.class)}) public void test_sql_jpa_entity_associations_query_one_to_many_join_example() { doInJPA( this::entityManagerFactory, entityManager -> { //tag::sql-jpa-entity-associations-query-one-to-many-join-example[] List phones = entityManager.createNativeQuery( "SELECT * " + "FROM phone ph " + - "JOIN call c ON c.phone_id = ph.id", Phone.class ) + "JOIN phone_call c ON c.phone_id = ph.id", Phone.class ) .getResultList(); for(Phone phone : phones) { @@ -417,7 +424,7 @@ public class SQLTest extends BaseEntityManagerFunctionalTestCase { List phones = session.createSQLQuery( "SELECT * " + "FROM phone ph " + - "JOIN call c ON c.phone_id = ph.id" ) + "JOIN phone_call c ON c.phone_id = ph.id" ) .addEntity("phone", Phone.class ) .addJoin( "c", "phone.calls") .setResultTransformer( Criteria.DISTINCT_ROOT_ENTITY ) @@ -436,6 +443,7 @@ public class SQLTest extends BaseEntityManagerFunctionalTestCase { } @Test + @RequiresDialects({@RequiresDialect(H2Dialect.class), @RequiresDialect(Oracle8iDialect.class), @RequiresDialect(PostgreSQL82Dialect.class)}) public void test_sql_hibernate_entity_associations_query_one_to_many_join_example_2() { doInJPA( this::entityManagerFactory, entityManager -> { Session session = entityManager.unwrap( Session.class ); @@ -443,7 +451,7 @@ public class SQLTest extends BaseEntityManagerFunctionalTestCase { List tuples = session.createSQLQuery( "SELECT * " + "FROM phone ph " + - "JOIN call c ON c.phone_id = ph.id" ) + "JOIN phone_call c ON c.phone_id = ph.id" ) .addEntity("phone", Phone.class ) .addJoin( "c", "phone.calls") .list(); @@ -686,6 +694,7 @@ public class SQLTest extends BaseEntityManagerFunctionalTestCase { } @Test + @RequiresDialects({@RequiresDialect(H2Dialect.class), @RequiresDialect(Oracle8iDialect.class), @RequiresDialect(PostgreSQL82Dialect.class)}) public void test_sql_jpa_entity_associations_named_query_example() { doInJPA( this::entityManagerFactory, entityManager -> { //tag::sql-jpa-entity-associations_named-query-example[] @@ -704,6 +713,7 @@ public class SQLTest extends BaseEntityManagerFunctionalTestCase { } @Test + @RequiresDialects({@RequiresDialect(H2Dialect.class), @RequiresDialect(Oracle8iDialect.class), @RequiresDialect(PostgreSQL82Dialect.class)}) public void test_sql_hibernate_entity_associations_named_query_example() { doInJPA( this::entityManagerFactory, entityManager -> { Session session = entityManager.unwrap( Session.class ); @@ -732,8 +742,8 @@ public class SQLTest extends BaseEntityManagerFunctionalTestCase { for(Object[] tuple : tuples) { SpaceShip spaceShip = (SpaceShip) tuple[0]; - Integer surface = (Integer) tuple[1]; - Integer volume = (Integer) tuple[2]; + Number surface = (Number) tuple[1]; + Number volume = (Number) tuple[2]; } //end::sql-jpa-composite-key-entity-associations_named-query-example[] assertEquals(1, tuples.size()); @@ -751,8 +761,8 @@ public class SQLTest extends BaseEntityManagerFunctionalTestCase { for(Object[] tuple : tuples) { SpaceShip spaceShip = (SpaceShip) tuple[0]; - Integer surface = (Integer) tuple[1]; - Integer volume = (Integer) tuple[2]; + Number surface = (Number) tuple[1]; + Number volume = (Number) tuple[2]; } //end::sql-hibernate-composite-key-entity-associations_named-query-example[] assertEquals(1, tuples.size()); diff --git a/documentation/src/test/java/org/hibernate/userguide/util/TransactionUtil.java b/documentation/src/test/java/org/hibernate/userguide/util/TransactionUtil.java index da1fc9e7a5..4d404da269 100644 --- a/documentation/src/test/java/org/hibernate/userguide/util/TransactionUtil.java +++ b/documentation/src/test/java/org/hibernate/userguide/util/TransactionUtil.java @@ -6,16 +6,16 @@ */ package org.hibernate.userguide.util; -import org.hibernate.Session; -import org.hibernate.SessionFactory; -import org.hibernate.Transaction; - -import javax.persistence.EntityManager; -import javax.persistence.EntityManagerFactory; -import javax.persistence.EntityTransaction; import java.util.function.Consumer; import java.util.function.Function; import java.util.function.Supplier; +import javax.persistence.EntityManager; +import javax.persistence.EntityManagerFactory; +import javax.persistence.EntityTransaction; + +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.hibernate.Transaction; /** * @author Vlad Mihalcea @@ -122,7 +122,7 @@ public class TransactionUtil { txn.begin(); result = function.apply(entityManager); txn.commit(); - } catch (RuntimeException e) { + } catch (Throwable e) { if ( txn != null && txn.isActive()) txn.rollback(); throw e; } finally { @@ -149,7 +149,7 @@ public class TransactionUtil { txn.begin(); function.accept(entityManager); txn.commit(); - } catch (RuntimeException e) { + } catch (Throwable e) { if ( txn != null && txn.isActive()) txn.rollback(); throw e; } finally { @@ -178,7 +178,7 @@ public class TransactionUtil { result = function.apply(session); txn.commit(); - } catch (RuntimeException e) { + } catch (Throwable e) { if ( txn != null ) txn.rollback(); throw e; } finally { @@ -205,7 +205,7 @@ public class TransactionUtil { function.accept(session); txn.commit(); - } catch (RuntimeException e) { + } catch (Throwable e) { if ( txn != null ) txn.rollback(); throw e; } finally { diff --git a/documentation/src/test/resources/hibernate.properties b/documentation/src/test/resources/hibernate.properties new file mode 100644 index 0000000000..cda8dd0f91 --- /dev/null +++ b/documentation/src/test/resources/hibernate.properties @@ -0,0 +1,24 @@ +# +# 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 . +# + +hibernate.dialect org.hibernate.dialect.H2Dialect +hibernate.connection.driver_class org.h2.Driver +hibernate.connection.url jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1;LOCK_TIMEOUT=10000 +hibernate.connection.username sa + +hibernate.connection.pool_size 5 + +hibernate.show_sql true +hibernate.format_sql true +hibernate.max_fetch_depth 5 + +hibernate.cache.region_prefix hibernate.test +hibernate.cache.region.factory_class org.hibernate.testing.cache.CachingRegionFactory + +hibernate.jdbc.batch_size 0 + +hibernate.service.allow_crawling=false