@Column annotation is disregarded for entities in an @ElementCollection if owning entity uses AccessType.PROPERTY for @Id field

Description

Given are the following two JPA entities:

Event.java

Tag.java

It seems that Hibernate disregards the @Column(nullable = false) annotation on Tag.value if and only if Event.id is annotated with @Access(AccessType.PROPERTY).

I published a minimal test case on https://github.com/bwaldvogel/hibernate-element-collection-access-type-issue.
EventTest.testPersistInvalidTag() unexpectedly fails on the assertion.

Activity

Show:

Former user March 28, 2016 at 7:06 PM

Duplicates HHH-9089.

Benedikt Waldvogel March 4, 2016 at 10:37 PM

It rather wasn’t added explicitly to express something but I stumbled upon this issue and it took me quite some time to reduce it to the AccessType annotation. At least it shouldn’t hurt, right?

Steve Ebersole February 28, 2016 at 5:47 PM

What exactly is it you are trying to express with the @Access(AccessType.PROPERTY) on the id attribute? I am confused by this.

Duplicate

Details

Assignee

Reporter

Components

Affects versions

Priority

Created November 25, 2015 at 1:52 PM
Updated December 3, 2024 at 9:28 AM
Resolved March 28, 2016 at 7:06 PM