On Sat, Oct 26, 2024, 3:25 PM Scott Marlow <smarlow(a)redhat.com> wrote:
If I change one of the failing tests to move the @Id to the fields, I
get
a different failure:
diff --git
a/hibernate-core/src/test/java/org/hibernate/orm/test/bytecode/enhancement/merge/MergeDetachedNonCascadedCollectionInEmbeddableTest.java
b/hibernate-core/src/test/java/org/hibernate/orm/test/bytecode/enhancement/merge/MergeDetachedNonCascaded
CollectionInEmbeddableTest.java
index e7cea27725..8900c29a4f 100644
---
a/hibernate-core/src/test/java/org/hibernate/orm/test/bytecode/enhancement/merge/MergeDetachedNonCascadedCollectionInEmbeddableTest.java
+++
b/hibernate-core/src/test/java/org/hibernate/orm/test/bytecode/enhancement/merge/MergeDetachedNonCascadedCollectionInEmbeddableTest.java
@@ -37,7 +37,7 @@ import org.junit.jupiter.api.Test;
}
)
@SessionFactory
-@BytecodeEnhanced
+@BytecodeEnhanced(testEnhancedClasses = {Heading.class, Grouping.class,
Thing.class})
public class MergeDetachedNonCascadedCollectionInEmbeddableTest {
@Test
@@ -64,12 +64,12 @@ public class
MergeDetachedNonCascadedCollectionInEmbeddableTest {
@Entity(name = "Heading")
public static class Heading {
+ @Id
+ @GeneratedValue
private long id;
private String name;
private Grouping grouping;
- @Id
- @GeneratedValue
public long getId() {
return id;
}
@@ -112,10 +112,10 @@ public class
MergeDetachedNonCascadedCollectionInEmbeddableTest {
@Entity(name = "Thing")
public static class Thing {
- private long id;
-
@Id
@GeneratedValue
+ private long id;
+
public long getId() {
return id;
}
Error:
<testcase name="initializationError" classname=
"org.hibernate.orm.test.bytecode.enhancement.merge.MergeDetachedNonCascadedCollectionInEmbeddableTest"
time="0.001">
<failure message="org.hibernate.MappingException: Basic collection has
element type
'org.hibernate.orm.test.bytecode.enhancement.merge.MergeDetachedNonCascadedCollectionInEmbeddableTest$Thing'
which is not a known basic type (attribute is not annota
ted '@ElementCollection', '@OneToMany', or '@ManyToMany')"
type=
"org.hibernate.MappingException">org.hibernate.MappingException: Basic
collection has element type
'org.hibernate.orm.test.bytecode.enhancement.merge.MergeDetachedNonCascadedCollectionInEmb
eddableTest$Thing' which is not a known basic type (attribute is not annotated
'@ElementCollection', '@OneToMany', or '@ManyToMany')
at
app//org.hibernate.type.descriptor.java.spi.BasicCollectionJavaType.getRecommendedJdbcType(BasicCollectionJavaType.java:72)
at
app//org.hibernate.boot.model.process.internal.InferredBasicValueResolver.from(InferredBasicValueResolver.java:195)
So further test changes may be needed but I have to ask if I should be
modifying the failing tests? Or should we introduce a way for
tests/applications to configure a service or configuration property to
determine whether the
https://github.com/hibernate/hibernate-orm/pull/9136
change applies to their application (via config property) or the platform
that ORM is part of (via new service)?
Or via a new annotation?
I also single stepped through the
https://github.com/hibernate/hibernate-orm/pull/9136 changes while
running the MergeDetachedNonCascadedCollectionInEmbeddableTest.testMergeDetached
test to verify that nothing unexpected is happening in the added code while
running this test.
Scott
On 10/25/24 1:50 PM, Scott Marlow wrote:
https://github.com/hibernate/hibernate-orm/pull/9136 seems to cause the
below tests to fail. Why is that? The idea of this pull request is to
disable enhancement for entity classes that have @Id/@Access(PROPERTY) on
property accessors as a workaround for
https://hibernate.atlassian.net/browse/HHH-16572.
List of failures:
Enhanced:MergeDetachedNonCascadedCollectionInEmbeddableTest >
Enhanced:testMergeDetached(SessionFactoryScope) FAILED
java.lang.NoSuchMethodError at
MergeDetachedNonCascadedCollectionInEmbeddableTest.java:47
Enhanced:LazyGroupWithInheritanceAllowProxyTest >
Enhanced:queryEntityWithAssociationToAbstract(SessionFactoryScope) FAILED
org.opentest4j.AssertionFailedError at
LazyGroupWithInheritanceAllowProxyTest.java:113
Enhanced:LazyGroupWithInheritanceAllowProxyTest >
Enhanced:testMergingUninitializedProxy(SessionFactoryScope) FAILED
java.lang.ClassCastException at
LazyGroupWithInheritanceAllowProxyTest.java:91
Enhanced:ManyToOneNoProxyTest > Enhanced:testSelect(SessionFactoryScope)
FAILED
java.lang.NoSuchMethodError at ManyToOneNoProxyTest.java:73
Enhanced:EnhancedProxyCacheTest >
Enhanced:testPreferenceFor2LCOverUninitializedProxy(SessionFactoryScope)
FAILED
java.lang.ClassCastException at EnhancedProxyCacheTest.java:80
Enhanced:LobUnfetchedPropertyTest >
Enhanced:testNClob(SessionFactoryScope) FAILED
java.lang.UnsupportedOperationException at
LobUnfetchedPropertyTest.java:114
Enhanced:UnexpectedDeleteTest3 > Enhanced:test(SessionFactoryScope) FAILED
java.lang.RuntimeException at UnexpectedDeleteTest3.java:42
Caused by: org.hibernate.PropertyNotFoundException at
UnexpectedDeleteTest3.java:42
Enhanced:LobUnfetchedPropertyTest > Enhanced:testClob(SessionFactoryScope)
FAILED
java.lang.UnsupportedOperationException at
LobUnfetchedPropertyTest.java:82
Enhanced:LobUnfetchedPropertyTest > Enhanced:testBlob(SessionFactoryScope)
FAILED
java.lang.UnsupportedOperationException at
LobUnfetchedPropertyTest.java:57
Enhanced:AbstractManyToOneNoProxyTest >
Enhanced:testSelect(SessionFactoryScope) FAILED
java.lang.NoSuchMethodError at AbstractManyToOneNoProxyTest.java:72
Enhanced:CascadeDeleteManyToOneTest >
Enhanced:testDetachedWithInitializedAssociation(SessionFactoryScope) FAILED
java.lang.AssertionError at CascadeDeleteManyToOneTest.java:113
Enhanced:CascadeDeleteManyToOneTest >
Enhanced:testManagedWithInitializedAssociation(SessionFactoryScope) FAILED
java.lang.AssertionError at CascadeDeleteManyToOneTest.java:86
Enhanced:CascadeDeleteCollectionTest >
Enhanced:testManagedWithUninitializedAssociation(SessionFactoryScope) FAILED
java.lang.NoSuchMethodError at CascadeDeleteCollectionTest.java:61
Enhanced:CascadeDeleteCollectionTest >
Enhanced:testDetachedWithInitializedAssociation(SessionFactoryScope) FAILED
java.lang.NoSuchMethodError at CascadeDeleteCollectionTest.java:61
Enhanced:CascadeDeleteCollectionTest >
Enhanced:testDetachedWithUninitializedAssociation(SessionFactoryScope)
FAILED
java.lang.NoSuchMethodError at CascadeDeleteCollectionTest.java:61
Enhanced:CascadeDeleteCollectionTest >
Enhanced:testManagedWithInitializedAssociation(SessionFactoryScope) FAILED
java.lang.NoSuchMethodError at CascadeDeleteCollectionTest.java:61
Enhanced:CascadeDeleteCollectionTest >
Enhanced:testDetachedOriginal(SessionFactoryScope) FAILED
java.lang.NoSuchMethodError at CascadeDeleteCollectionTest.java:61
Enhanced:CascadeDeleteCollectionWithCollectionInDefaultFetchGroupFalseTest
> Enhanced:testDetachedWithInitializedAssociation(SessionFactoryScope)
FAILED
java.lang.NoSuchMethodError at
CascadeDeleteCollectionWithCollectionInDefaultFetchGroupFalseTest.java:71
Enhanced:CascadeDeleteCollectionWithCollectionInDefaultFetchGroupFalseTest
> Enhanced:testManagedWithInitializedAssociation(SessionFactoryScope) FAILED
java.lang.NoSuchMethodError at
CascadeDeleteCollectionWithCollectionInDefaultFetchGroupFalseTest.java:71
Enhanced:CascadeDeleteCollectionWithCollectionInDefaultFetchGroupFalseTest
> Enhanced:testDetachedOriginal(SessionFactoryScope) FAILED
java.lang.NoSuchMethodError at
CascadeDeleteCollectionWithCollectionInDefaultFetchGroupFalseTest.java:71
Enhanced:CascadeDeleteCollectionWithCollectionInDefaultFetchGroupFalseTest
> Enhanced:testDetachedWithUninitializedAssociation(SessionFactoryScope)
FAILED
java.lang.NoSuchMethodError at
CascadeDeleteCollectionWithCollectionInDefaultFetchGroupFalseTest.java:71
Enhanced:CascadeDeleteCollectionWithCollectionInDefaultFetchGroupFalseTest
> Enhanced:testManagedWithUninitializedAssociation(SessionFactoryScope)
FAILED
java.lang.NoSuchMethodError at
CascadeDeleteCollectionWithCollectionInDefaultFetchGroupFalseTest.java:71
Enhanced:MergeProxyTest >
Enhanced:testMergeDetachInitializedProxy(SessionFactoryScope) FAILED
java.lang.AssertionError at MergeProxyTest.java:105
Enhanced:MergeProxyTest >
Enhanced:testMergeDetachUninitializedProxy(SessionFactoryScope) FAILED
java.lang.AssertionError at MergeProxyTest.java:72
Enhanced:MergeProxyTest >
Enhanced:testMergeDetachInitializedByAccessProxy(SessionFactoryScope) FAILED
java.lang.AssertionError at MergeProxyTest.java:150
Enhanced[EnhancerTestContext]:BidirectionalLazyTest >
Enhanced[EnhancerTestContext]:testRemoveEntityWithLinkedLazyManyToOne(SessionFactoryScope)
FAILED
java.lang.AssertionError at BidirectionalLazyTest.java:268
Enhanced:LazyGroupWithInheritanceTest >
Enhanced:loadEntityWithAssociationToAbstract(SessionFactoryScope) FAILED
java.lang.AssertionError at LazyGroupWithInheritanceTest.java:77
Enhanced[EnhancerTestContext]:BidirectionalLazyTest >
Enhanced[EnhancerTestContext]:testRemoveWithNoRemovedEntities(SessionFactoryScope)
FAILED
java.lang.AssertionError at BidirectionalLazyTest.java:268
Enhanced[NoDirtyCheckEnhancementContext]:BidirectionalLazyTest >
Enhanced[NoDirtyCheckEnhancementContext]:testRemoveEntityWithLinkedLazyManyToOne(SessionFactoryScope)
FAILED
java.lang.AssertionError at BidirectionalLazyTest.java:268
Enhanced:FetchGraphTest >
Enhanced:testNullManyToOneHql(SessionFactoryScope) FAILED
java.lang.AssertionError at FetchGraphTest.java:512
Enhanced[NoDirtyCheckEnhancementContext]:BidirectionalLazyTest >
Enhanced[NoDirtyCheckEnhancementContext]:testRemoveWithNoRemovedEntities(SessionFactoryScope)
FAILED
java.lang.AssertionError at BidirectionalLazyTest.java:268
Enhanced:LazyGroupWithInheritanceTest >
Enhanced:queryEntityWithAssociationToAbstract(SessionFactoryScope) FAILED
org.opentest4j.AssertionFailedError at
LazyGroupWithInheritanceTest.java:108
Enhanced:MergeDetachedCascadedCollectionInEmbeddableTest >
Enhanced:testMergeDetached(SessionFactoryScope) FAILED
java.lang.NoSuchMethodError at
MergeDetachedCascadedCollectionInEmbeddableTest.java:53
Enhanced:JoinFetchWithEnhancementTest >
Enhanced:testJoinFetchWithEnhancement(SessionFactoryScope) FAILED
java.lang.NoSuchMethodError at JoinFetchWithEnhancementTest.java:53
Enhanced:MissingSetterWithEnhancementTest >
Enhanced:testEnhancedClassMissesSetterForProperty() FAILED
org.opentest4j.AssertionFailedError at
MissingSetterWithEnhancementTest.java:61
Enhanced:PropertyAccessTest > Enhanced:test(SessionFactoryScope) FAILED
java.lang.NoSuchMethodError at PropertyAccessTest.java:39
Enhanced:LazyLoadingByEnhancerSetterTest >
Enhanced:testProperty(SessionFactoryScope) FAILED
org.hibernate.testing.orm.junit.FailureExpectedExtension$ExpectedFailureDidNotFail
at FailureExpectedExtension.java:124
Enhanced:RemoveUninitializedLazyCollectionTest >
Enhanced:testDeleteParentWithBidirOrphanDeleteCollectionBasedOnPropertyRef(SessionFactoryScope)
FAILED
java.lang.NoSuchMethodError at
RemoveUninitializedLazyCollectionTest.java:70
Enhanced:LazyBasicPropertyAccessTest >
Enhanced:testAttachedUpdate(SessionFactoryScope) FAILED
org.opentest4j.AssertionFailedError at
LazyBasicPropertyAccessTest.java:70
Enhanced:LazyBasicPropertyAccessTest >
Enhanced:testDetachedUpdate(SessionFactoryScope) FAILED
org.opentest4j.AssertionFailedError at
LazyBasicPropertyAccessTest.java:100
Scott