From 08bd46670311826b3e7064b6dd0ca7f2d3c660d0 Mon Sep 17 00:00:00 2001 From: Steve Ebersole Date: Wed, 28 Aug 2024 17:10:48 -0500 Subject: [PATCH] HHH-18498 - Generator on package level does not work when the name is not specified HHH-18499 - Some new functions in Persistence 3.2 does not work HHH-18536 - Support implicit "this" alias in HQL HHH-18537 - Support Session#createNamedSelectionQuery for native-query --- .../generators/entity/ClassLevelGeneratorTest.java | 4 ++++ .../generators/entity/FieldLevelGeneratorTest.java | 4 ++++ .../generators/pkg/PackageLevelGeneratorTest.java | 4 ++++ .../NamedNativeQueryWithResultMappingTest.java | 8 ++++++-- .../orm/test/query/hql/thisalias/HQLThisTest.java | 14 +++++++++++--- .../query/resultmapping/EntityResultTests.java | 4 ++++ 6 files changed, 33 insertions(+), 5 deletions(-) diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/id/generators/entity/ClassLevelGeneratorTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/id/generators/entity/ClassLevelGeneratorTest.java index cf16e6c529..8e94ae005f 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/id/generators/entity/ClassLevelGeneratorTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/id/generators/entity/ClassLevelGeneratorTest.java @@ -6,6 +6,8 @@ import jakarta.persistence.Id; import jakarta.persistence.SequenceGenerator; import jakarta.persistence.TableGenerator; import org.hibernate.testing.orm.junit.DomainModel; +import org.hibernate.testing.orm.junit.FailureExpected; +import org.hibernate.testing.orm.junit.Jira; import org.hibernate.testing.orm.junit.SessionFactory; import org.hibernate.testing.orm.junit.SessionFactoryScope; import org.junit.jupiter.api.Test; @@ -16,6 +18,8 @@ import static org.junit.jupiter.api.Assertions.assertEquals; @DomainModel(annotatedClasses = {ClassLevelGeneratorTest.EntityWithAnonSequenceGenerator.class, ClassLevelGeneratorTest.EntityWithAnonTableGenerator.class}) +@FailureExpected( reason = "Support for unnamed generators is not implemented yet" ) +@Jira( "https://hibernate.atlassian.net/browse/HHH-18498" ) public class ClassLevelGeneratorTest { @Test void testAnonGenerator(SessionFactoryScope scope) { diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/id/generators/entity/FieldLevelGeneratorTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/id/generators/entity/FieldLevelGeneratorTest.java index 3bd9ab6229..4609bab273 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/id/generators/entity/FieldLevelGeneratorTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/id/generators/entity/FieldLevelGeneratorTest.java @@ -6,6 +6,8 @@ import jakarta.persistence.Id; import jakarta.persistence.SequenceGenerator; import jakarta.persistence.TableGenerator; import org.hibernate.testing.orm.junit.DomainModel; +import org.hibernate.testing.orm.junit.FailureExpected; +import org.hibernate.testing.orm.junit.Jira; import org.hibernate.testing.orm.junit.SessionFactory; import org.hibernate.testing.orm.junit.SessionFactoryScope; import org.junit.jupiter.api.Test; @@ -16,6 +18,8 @@ import static org.junit.jupiter.api.Assertions.assertEquals; @DomainModel(annotatedClasses = {FieldLevelGeneratorTest.EntityWithAnonSequenceGenerator.class, FieldLevelGeneratorTest.EntityWithAnonTableGenerator.class}) +@FailureExpected( reason = "Support for unnamed generators is not implemented yet" ) +@Jira( "https://hibernate.atlassian.net/browse/HHH-18498" ) public class FieldLevelGeneratorTest { @Test void testAnonGenerator(SessionFactoryScope scope) { diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/id/generators/pkg/PackageLevelGeneratorTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/id/generators/pkg/PackageLevelGeneratorTest.java index 9337aaecd9..4885b13fca 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/id/generators/pkg/PackageLevelGeneratorTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/id/generators/pkg/PackageLevelGeneratorTest.java @@ -4,6 +4,8 @@ import jakarta.persistence.Entity; import jakarta.persistence.GeneratedValue; import jakarta.persistence.Id; import org.hibernate.testing.orm.junit.DomainModel; +import org.hibernate.testing.orm.junit.FailureExpected; +import org.hibernate.testing.orm.junit.Jira; import org.hibernate.testing.orm.junit.SessionFactory; import org.hibernate.testing.orm.junit.SessionFactoryScope; import org.junit.jupiter.api.Test; @@ -14,6 +16,8 @@ import static org.junit.jupiter.api.Assertions.assertEquals; @DomainModel(annotatedClasses = {PackageLevelGeneratorTest.EntityWithAnonSequenceGenerator.class, PackageLevelGeneratorTest.EntityWithAnonTableGenerator.class}) +@FailureExpected( reason = "Support for unnamed generators is not implemented yet" ) +@Jira( "https://hibernate.atlassian.net/browse/HHH-18498" ) public class PackageLevelGeneratorTest { @Test void testAnonGenerator(SessionFactoryScope scope) { diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/query/NamedNativeQueryWithResultMappingTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/query/NamedNativeQueryWithResultMappingTest.java index a2515058fc..700803d455 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/query/NamedNativeQueryWithResultMappingTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/query/NamedNativeQueryWithResultMappingTest.java @@ -9,20 +9,24 @@ import jakarta.persistence.Id; import jakarta.persistence.NamedNativeQuery; import jakarta.persistence.Table; import org.hibernate.testing.orm.junit.DomainModel; +import org.hibernate.testing.orm.junit.FailureExpected; +import org.hibernate.testing.orm.junit.Jira; import org.hibernate.testing.orm.junit.SessionFactory; import org.hibernate.testing.orm.junit.SessionFactoryScope; import org.junit.jupiter.api.Test; @SessionFactory @DomainModel(annotatedClasses = NamedNativeQueryWithResultMappingTest.Mapped.class) +@FailureExpected( jiraKey = "HHH-18537", reason = "Call to #createNamedSelectionQuery for native-query, which never worked." ) +@Jira( "https://hibernate.atlassian.net/browse/HHH-18537" ) public class NamedNativeQueryWithResultMappingTest { @Test void test(SessionFactoryScope scope) { Mapped mapped = new Mapped(); mapped.name = "Gavin"; scope.inTransaction(s -> s.persist(mapped)); scope.inSession(s -> { - s.createNamedSelectionQuery("mapped-native-query").getSingleResult(); - s.createNamedSelectionQuery("unmapped-native-query").getSingleResult(); + s.createNamedSelectionQuery("mapped-native-query",Object[].class).getSingleResult(); + s.createNamedSelectionQuery("unmapped-native-query",Object[].class).getSingleResult(); }); } @NamedNativeQuery( diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/thisalias/HQLThisTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/thisalias/HQLThisTest.java index 6b7aded87f..d5212310b9 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/thisalias/HQLThisTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/thisalias/HQLThisTest.java @@ -5,12 +5,16 @@ import jakarta.persistence.Entity; import jakarta.persistence.GeneratedValue; import jakarta.persistence.Id; import org.hibernate.testing.orm.junit.DomainModel; +import org.hibernate.testing.orm.junit.FailureExpected; +import org.hibernate.testing.orm.junit.Jira; import org.hibernate.testing.orm.junit.SessionFactory; import org.hibernate.testing.orm.junit.SessionFactoryScope; import org.junit.jupiter.api.Test; @SessionFactory @DomainModel(annotatedClasses = HQLThisTest.This.class) +@FailureExpected( jiraKey = "HHH-18536", reason = "Support implicit \"this\" alias in HQL" ) +@Jira( "https://hibernate.atlassian.net/browse/HHH-18536" ) public class HQLThisTest { @Test void test(SessionFactoryScope scope) { @@ -23,14 +27,18 @@ public class HQLThisTest { s.createSelectionQuery("select id(this) from This").getSingleResult(); }); } - @Entity + @Entity(name="This") static class This { @Id @GeneratedValue long id; @Basic(optional = false) String name; - This(String gavin) {} - This() {} + This(String name) { + this.name = name; + } + + This() { + } } } diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/query/resultmapping/EntityResultTests.java b/hibernate-core/src/test/java/org/hibernate/orm/test/query/resultmapping/EntityResultTests.java index 0a19c1622e..1c4b79d5dd 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/query/resultmapping/EntityResultTests.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/query/resultmapping/EntityResultTests.java @@ -23,6 +23,8 @@ import org.hibernate.query.named.NamedResultSetMappingMemento; import org.hibernate.testing.orm.domain.gambit.EntityOfBasics; import org.hibernate.testing.orm.junit.DomainModel; +import org.hibernate.testing.orm.junit.FailureExpected; +import org.hibernate.testing.orm.junit.Jira; import org.hibernate.testing.orm.junit.ServiceRegistry; import org.hibernate.testing.orm.junit.SessionFactoryScope; import org.hibernate.testing.orm.junit.Setting; @@ -121,6 +123,8 @@ public class EntityResultTests extends AbstractUsageTest { } @Test + @FailureExpected( jiraKey = "HHH-18535", reason = "Support for @EntityResult(lockMode) not implemented yet") + @Jira( "https://hibernate.atlassian.net/browse/HHH-18535" ) public void testImplicitAttributeMappingWithLockMode(SessionFactoryScope scope) { scope.inTransaction( session -> {