Reputation: 25460
I'm trying to persist my object but when I look in the dev console, not all of the properties on the objects are set. Some are null and some are missing. What is going wrong?
Upvotes: 1
Views: 85
Reputation: 25460
I spent the afternoon tearing my hair out over this one and I have a feeling I've gone through this before. I'm posting here so hopefully I'll find this if I make the same mistake again...
For me, the problem was a setting in eclipse that inserted the "final" keyword on private fields. While this is a good idea for most java objects (with fields you consider immutable), it's no good here because final members will not be persisted to the database. Including a setter will prevent eclipse from inserting the "final" keyword but this sucks because you are communicating the idea that this field is mutable. I've just had to disable that save action in eclipse.
Upvotes: 1