You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@isis.apache.org by Miguel Payet <mp...@fastmail.fm> on 2015/04/19 02:12:41 UTC

Questions regarding my first Isis application

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

Re: Questions regarding my first Isis application

Posted by Luis Miguel Payet <mp...@fastmail.fm>.
Thank you, Jeroen. Using background tasks to clean up incomplete timesheets is a great idea. 
 
> On Apr 19, 2015, at 5:25, Jeroen van der Wal <je...@stromboli.it> wrote:
> 
> 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 <mp...@fastmail.fm> 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
>> 


Re: Questions regarding my first Isis application

Posted by Jeroen van der Wal <je...@stromboli.it>.
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 <mp...@fastmail.fm> 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
>