Skip to content

Commit 83b1079

Browse files
committed
fix for GRAILS-6053 "AbstractSavePersistentMethod.autoRetrieveAssocations cannot handle non-nullable keys"
1 parent 22365ef commit 83b1079

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/java/org/codehaus/groovy/grails/orm/hibernate/metaclass/AbstractSavePersistentMethod.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,10 @@ private void autoRetrieveAssocations(GrailsDomainClass domainClass, Object targe
181181
try {
182182
Serializable id = (Serializable) propBean.getPropertyValue(otherSide.getIdentifier().getName());
183183
if (id != null) {
184-
bean.setPropertyValue(prop.getName(), t.get(prop.getType(), id));
184+
final Object propVal = t.get(prop.getType(), id);
185+
if(propVal != null) {
186+
bean.setPropertyValue(prop.getName(), propVal);
187+
}
185188
}
186189
} catch (InvalidPropertyException ipe) {
187190
// property is not accessable

0 commit comments

Comments
 (0)