Filip Procházka (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) *updated* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiYTdhNjU2N2Yw...
) / Bug (
https://hibernate.atlassian.net/browse/HHH-14151?atlOrigin=eyJpIjoiYTdhNj...
) HHH-14151 (
https://hibernate.atlassian.net/browse/HHH-14151?atlOrigin=eyJpIjoiYTdhNj...
) SingularAttribute.isOptional() does not honour javax.validation.constraints.NotNull (
https://hibernate.atlassian.net/browse/HHH-14151?atlOrigin=eyJpIjoiYTdhNj...
)
Change By: Filip Procházka (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
)
I've just upgraded Spring Boot, which upgraded Hibernate ORM from 5.4.12.Final to
5.4.18.Final
I have an association
{code:java}
@javax.persistence.ManyToOne(fetch = FetchType.LAZY)
@javax.validation.constraints.NotNull
private Product product;
{code}
I have logic that inspects metadata and collects nullable associations of an entity
{code:java}
List<Attribute<?, ?>> fields = new ArrayList<>();
fields.addAll(entityType.getSingularAttributes().stream()
.filter(singularAttribute -> singularAttribute.isAssociation()
&& singularAttribute.getType() instanceof EntityType
&& singularAttribute.isOptional())
.collect(Collectors.toList()));
return fields;
{code}
where `entityType` is `javax.persistence.metamodel.EntityType`
Previously, the `isOptional` honoured the `NotNull` constraint and returned false, not now
it returns true which breaks my logic. I'm not yet sure if this is a
miss-configuration by Spring Boot or by my application or if it's a bug in Hibernate,
but with the upgrade this changed unexpectedly.
(
https://hibernate.atlassian.net/browse/HHH-14151#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-14151#add-comment?atlOrigin=ey...
)
Get Jira notifications on your phone! Download the Jira Cloud app for Android (
https://play.google.com/store/apps/details?id=com.atlassian.android.jira....
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100144- sha1:57e1ab7 )