Issues
- Envers fails to initialize Map with Embeddables (Could not resolve attribute 'REVTYPE' of 'java.util.Map')HHH-18779
- Deploying Hibernate on WAS 8.5.5 tries to use Liberty JTA PlatformHHH-16134
- Metamodel imports cache increases indefinitely for dynamically generated HQL aliases eventually leading to an OOMHHH-14948Resolved issue: HHH-14948Ivaylo Mitrev
- Converters defined through orm.xml are never retrieved from the CDI contextHHH-14881Resolved issue: HHH-14881Yoann Rodière
- <converter class="..."> in orm.xml ignores the <package> elementHHH-14880Resolved issue: HHH-14880Yoann Rodière
5 of 5
Envers fails to initialize Map with Embeddables (Could not resolve attribute 'REVTYPE' of 'java.util.Map')
Description
Attachments
1
Details
Details
Assignee
Unassigned
UnassignedReporter
Lukas
LukasLabels
Components
Priority
Created October 29, 2024 at 1:04 PM
Updated November 14, 2024 at 8:18 AM
Activity
Show:
stringintech November 5, 2024 at 9:38 PMEdited
Apparently, the issue was first reported in https://hibernate.atlassian.net/browse/HHH-11841 and fixed, but that fix was reverted because it caused a new issue (https://hibernate.atlassian.net/browse/HHH-12018 ). A proper fix was planned in https://hibernate.atlassian.net/browse/HHH-12043 , but it hasn’t been done yet.
Also see EntityMapCompositeElementTest.
There is a problem when an entity with a Map containing
@Embeddable
values is loaded from Envers.package datamodel; import org.hibernate.envers.Audited; import jakarta.persistence.*; @Audited @Entity @Table(name = "users") public class User { @Id @GeneratedValue(strategy = GenerationType.SEQUENCE) private long id; } @Embeddable public class Address { @Column private String street; } @Audited @Entity public class UserAddress { @Id @GeneratedValue(strategy = GenerationType.SEQUENCE) private long id; @ElementCollection(fetch = FetchType.EAGER) private Map<User, Address> entries = new HashMap<>(); // the map }
The problem occurs when a UserAddress entity is loaded via Envers:
final List<UserAddress> revisions = getAuditReader().createQuery() .forRevisionsOfEntity(UserAddress.class, true, true) .add(AuditEntity.id().eq(userAddressId)) // identifier .getResultList(); revisions.getFirst().getEntries().size(); // Exception
The following Exception is thrown:
A full reproducer is attached.