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?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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.