Skip to content

Commit

Permalink
HBX-2614 - Check isNullable() in BasicPOJOClass::isRequiredInConstruc…
Browse files Browse the repository at this point in the history
…tor.

Restores previous Minimal Constructors behavior lost when isNullable() check removed from core org.hibernate.mapping.Property.isOptional().
  • Loading branch information
jimbogithub authored and koentsje committed Oct 17, 2023
1 parent 5b63c2f commit c42c9a9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/java/org/hibernate/tool/hbm2x/pojo/BasicPOJOClass.java
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,9 @@ protected boolean isRequiredInConstructor(Property field) {
return false;
}
if(field.getValue()!=null) {
if (!field.isOptional() && (field.getValueGenerationStrategy() == null || field.getValueGenerationStrategy().getGenerationTiming().equals(GenerationTiming.NEVER))) {
if (!(field.isOptional() || field.getValue().isNullable()) &&
(field.getValueGenerationStrategy() == null ||
field.getValueGenerationStrategy().getGenerationTiming().equals(GenerationTiming.NEVER))) {
return true;
} else if (field.getValue() instanceof Component) {
Component c = (Component) field.getValue();
Expand Down

0 comments on commit c42c9a9

Please sign in to comment.