Hi Miguel,

It is impossible to lazily persist a transient instance. A quick solution
would be to persist the new timesheet and clean up not completed time
sheets in a background task.

You can also take a look at view models [1] as a pattern to deal with non
persistent objects. Bear in mind however that view models are immutable.

[1] http://isis.apache.org/more-advanced-topics/ViewModel.html

On 19 April 2015 at 02:12, Miguel Payet <[email protected]> wrote:

> Hello, I have a question:
>
> Is is possible to persist an object only after editing it? I have an
> action like this, but am unable to make the object persistent after
> editing and pressing the "OK" button.
>
>         @ActionLayout(bookmarking = BookmarkPolicy.NEVER, named =
>         "Create timesheet")
>         @MemberOrder(sequence = "1")
>         public Timesheet create() {
>                 final Timesheet obj =
>                 container.newTransientInstance(Timesheet.class);
>                 return obj;
>         }
>
> Thanks for your help.
>
> Miguel
>

Reply via email to