> CayenneForm.getDataObject() handling of new objects problem
> -----------------------------------------------------------
>
> Key: CLK-73
> URL:
http://www.avoka.com:8080/jira/browse/CLK-73> Project: Click
> Issue Type: Bug
> Components: core
> Environment: Click 0.18 (but I believe it is the same in current CVS version)
> Reporter: Andrus Adamchik
> Assigned To: Malcolm Edgar
> Attachments: click.patch
>
>
> Calling CayenneForm.getDataObject() more than once for the NEW object results in duplicate insert. I have a case when I need to manipulate a DataObject before saving it, so the action method code looks like this:
> // 'getDataObject() - call #1
> JobPost post = (JobPost) form.getDataObject();
> // do something to POST
> ...
> // 'getDataObject() - call #2
> form.saveChanges()
> here two records are inserted instead of one.
> So maybe we should store DataObject in a transient field of the form for the duration of request, so that consecutive calls to getDataObject do not instantiate it again?