Environment
Spring/hibernate/MySQL web application
Problem
I have a multi-step form which should be savable at every step for completing later. But incomplete steps may contain fields that are required for the model, making it not possible to save the model.
What I have tried or thought about trying
- Making fields nullable.
- Using a temporary table to save incomplete forms
But..
Solution 1 disrupts database design, and solution 2 will bloat my code with fragments to convert between the temporary model and the permanent one, and this will get ugly if I add the ability to edit the form after saving it.
How to implement the complete later feature in a way that is seamless and elegant?
Another option is to have a
booleancolumn in your database tablecomplete_edit. and for those columns that are not entered in first place during save, either store default value or a string like “NOT_COMPLETE” and setcomplete_editcolumn as false. Only on submit this column should be true.