1919import org .hibernate .annotations .NotFoundAction ;
2020import org .hibernate .engine .internal .ForeignKeys ;
2121import org .hibernate .engine .jdbc .Size ;
22- import org .hibernate .engine .spi .*;
22+ import org .hibernate .engine .spi .EntityEntry ;
23+ import org .hibernate .engine .spi .EntityKey ;
24+ import org .hibernate .engine .spi .EntityUniqueKey ;
25+ import org .hibernate .engine .spi .Mapping ;
26+ import org .hibernate .engine .spi .PersistenceContext ;
27+ import org .hibernate .engine .spi .SharedSessionContractImplementor ;
2328import org .hibernate .persister .entity .EntityPersister ;
2429import org .hibernate .persister .entity .Loadable ;
2530
3035 */
3136public class ManyToOneType extends EntityType {
3237 private final String propertyName ;
38+ private final boolean nullable ;
3339 private final NotFoundAction notFoundAction ;
3440 private boolean isLogicalOneToOne ;
3541
@@ -57,7 +63,7 @@ public ManyToOneType(TypeFactory.TypeScope scope, String referencedEntityName, b
5763
5864
5965 /**
60- * @deprecated Use {@link #ManyToOneType(TypeFactory.TypeScope, String, boolean, String, String, boolean, boolean, NotFoundAction, boolean ) } instead.
66+ * @deprecated Use {@link #ManyToOneType(TypeFactory.TypeScope, String, boolean, String, String, boolean, boolean, boolean, NotFoundAction, boolean ) } instead.
6167 */
6268 @ Deprecated
6369 public ManyToOneType (
@@ -73,7 +79,7 @@ public ManyToOneType(
7379 }
7480
7581 /**
76- * @deprecated Use {@link #ManyToOneType(TypeFactory.TypeScope, String, boolean, String, String, boolean, boolean, NotFoundAction, boolean ) } instead.
82+ * @deprecated Use {@link #ManyToOneType(TypeFactory.TypeScope, String, boolean, String, String, boolean, boolean, boolean, NotFoundAction, boolean ) } instead.
7783 */
7884 @ Deprecated
7985 public ManyToOneType (
@@ -85,7 +91,18 @@ public ManyToOneType(
8591 boolean unwrapProxy ,
8692 NotFoundAction notFoundAction ,
8793 boolean isLogicalOneToOne ) {
88- this ( scope , referencedEntityName , referenceToPrimaryKey , uniqueKeyPropertyName , null , lazy , unwrapProxy , notFoundAction , isLogicalOneToOne );
94+ this (
95+ scope ,
96+ referencedEntityName ,
97+ referenceToPrimaryKey ,
98+ uniqueKeyPropertyName ,
99+ null ,
100+ notFoundAction != null ,
101+ lazy ,
102+ unwrapProxy ,
103+ notFoundAction ,
104+ isLogicalOneToOne
105+ );
89106 }
90107
91108 public ManyToOneType (
@@ -94,13 +111,15 @@ public ManyToOneType(
94111 boolean referenceToPrimaryKey ,
95112 String uniqueKeyPropertyName ,
96113 String propertyName ,
114+ boolean nullable ,
97115 boolean lazy ,
98116 boolean unwrapProxy ,
99117 NotFoundAction notFoundAction ,
100118 boolean isLogicalOneToOne ) {
101119 super ( scope , referencedEntityName , referenceToPrimaryKey , uniqueKeyPropertyName , !lazy , unwrapProxy );
102120 this .propertyName = propertyName ;
103121 this .notFoundAction = notFoundAction ;
122+ this .nullable = nullable ;
104123 this .isLogicalOneToOne = isLogicalOneToOne ;
105124 }
106125
@@ -109,12 +128,12 @@ public ManyToOneType(ManyToOneType original, String superTypeEntityName) {
109128 this .propertyName = original .propertyName ;
110129 this .notFoundAction = original .notFoundAction ;
111130 this .isLogicalOneToOne = original .isLogicalOneToOne ;
131+ this .nullable = original .nullable ;
112132 }
113133
114134 @ Override
115135 public boolean isNullable () {
116- // this matches the original check, but this seems wrong.
117- return notFoundAction == NotFoundAction .IGNORE ;
136+ return notFoundAction != null ;
118137 }
119138
120139 @ Override
0 commit comments