I'm using Play Framework 2 and Ebean. When a user submits a form to edit an existing object in the database, it doesn't save null values. I guess this is to prevent overwriting fields that aren't in the form with null. But how can I let them set fields in the form to null if they need to?
For example, the user edits an Event
object. Event.date
is 1/1/13. The user sets the Event.date
field in the form to empty and submits the form. Inspecting Event.date
in the debugger shows its value is null. I save the Event
. If I look at the Event
in the database, its value is still 1/1/13.
Edit: It seems there is a method for this. The only problem is it doesn't work on nested entities. Any solutions for this?
update(Object bean,Set<String> properties)