| I've just upgraded Spring Boot, which upgraded Hibernate ORM from 5.4.12.Final to 5.4.18.Final I have an association
@javax.persistence.ManyToOne(fetch = FetchType.LAZY)
@javax.validation.constraints.NotNull
private Product product;
I have logic that inspects metadata and collects nullable associations of an entity
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;
where `entityType` is `javax.persistence.metamodel.EntityType` Previously, the `isOptional` honoured the `NotNull` constraint and returned false, not 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. |