Hello,
I just ran into a strange situation with partial entities. I have a NotificationTransaction base class in a framework, and an RNotificationTransaction partial entity in an application which has only a single additional relationship to an application-level School entity. Here is a WOUnit test:
@Test public void transactionShouldBeSaveableWithSchoolSet() { trans.setDateStart(new DateTime()); trans.setRecipient("foo"); trans.setStatus(Status.COMPLETE_SUCCESS); trans.setUuid("foo"); trans.partialForClass(RNotificationTransaction.class) .setSchoolRelationship(school); confirm(trans, canBeSaved()); return; }
If RNotificationTransaction.school is marked mandatory in the model, that fails with a NullPropertyException on the schoolID attribute (which is _not_ marked as a class property). If I flip it to optional, it passes. (And in the actual application, I can confirm that even when it's optional, the appropriate schoolID _is_ written out to the database.)
I'm not sure how many people are using partial entities all that heavily, but has anyone seen this? Can anyone suggest what might be going on? (How late would a foreign key attribute like this normally be set?)
|