It can't - city should be null. The problem is that I get a null pointer exception because p.getHomeAddress() is null. Again, remember that this is a simplified domain model, and only exists to demonstrate the issue. As best I can tell, if any of the properties of the embedded object are not null, the embedded object itself is not null. But if all of the properties of the embedded object are null, the embedded object is null when retrieved from the database.
I figure I can work around this by making sure that one property is always not null, but that's not a real solution.
Main Topics
Browse All Topics





by: CEHJPosted on 2006-08-06 at 10:05:09ID: 17259353
>>p.setHomeAddress(new Address());
ty(); // null pointer exception here!
>>p.getHomeAddress().getCi
How can it have a city when one (per the above) has not been set?