JDO not retrieving/persisting a collection
I have the following data model class defined:
@PersistenceCapable
public class TestSerializableModelObj {
@Persistent(serialized="true", defaultFetchGroup="true")
private MyPOJO myField;
@Persistent(serialized="true", defaultFetchGroup="true")
private Collection<MyPOJO> myCollection;
// getter/setters
}
MyPOJO is just a simple class that implements Serializable.
When I persist th开发者_如何学JAVAis via DataNucleus/JDO and retrieve it I can read myField
just fine, but myCollection
is null (though I set it to be an Vector of two MyPOJO objects before persisting it).
Although I didn't mention it in the question, I was using DB4O as the database engine. I swapped it out for NeoDatis and magically all my problems went away, all my test cases worked perfectly.
Don't know why DB4O doesn't like me, and at this point I don't care, NeoDatis "Just Works", and DB4O doesn't.
In fact I spent 3 days fighting with every conceivable problem possible with DB4O and in 5 minutes had every test case I had created in those 3 days working under NeoDatis.
精彩评论