You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by René Stolle <st...@posteo.de> on 2018/08/02 16:00:05 UTC
Recommenced way of dealing with non Serializable Objects in Forms
Hello,
I simply wanna edit non Serializable domain objects in a html form. The
Form should
work for inserts (new objects) and updates. I created a
LoadableDetachableModel for
the given Domain which keeps a (database) id and has the following load
method:
@Override
protected Testobject load() {
if (DomainEntity.isPersistent(id)) {
return Testobject.findOne(id);
} else {
return new Testobject();
}
}
So if the id indicates persistence, the Testobject is loaded from the
data source.
If not, a new Testobject is created.
I put this Model in a CompoundPropertyModel and everythings works fine.
But I wonder if there are other solutions?
Regards,
Rene
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Recommenced way of dealing with non Serializable Objects in Forms
Posted by rstolle <rs...@posteo.de>.
Sven thanks a lot! I just wanted to make sure to do it right before I
start to always use this approach.
Regards,
Rene
---
Artificial intelligence is no match for natural stupidity
Am 2018-08-02 18:22 schrieb Sven Meier:
> Hi,
>
> that's perfectly fine.
>
> Why are you looking for another solution?
>
> Have fun
> Sven
>
>
> Am 2. August 2018 18:00:05 MESZ schrieb "René Stolle"
> <st...@posteo.de>:
>> Hello,
>>
>> I simply wanna edit non Serializable domain objects in a html form.
>> The
>>
>> Form should
>> work for inserts (new objects) and updates. I created a
>> LoadableDetachableModel for
>> the given Domain which keeps a (database) id and has the following
>> load
>>
>> method:
>>
>> @Override
>> protected Testobject load() {
>> if (DomainEntity.isPersistent(id)) {
>> return Testobject.findOne(id);
>> } else {
>> return new Testobject();
>> }
>> }
>>
>> So if the id indicates persistence, the Testobject is loaded from the
>> data source.
>> If not, a new Testobject is created.
>>
>> I put this Model in a CompoundPropertyModel and everythings works
>> fine.
>>
>> But I wonder if there are other solutions?
>>
>> Regards,
>> Rene
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Recommenced way of dealing with non Serializable Objects in Forms
Posted by Sven Meier <sv...@meiers.net>.
Hi,
that's perfectly fine.
Why are you looking for another solution?
Have fun
Sven
Am 2. August 2018 18:00:05 MESZ schrieb "René Stolle" <st...@posteo.de>:
>Hello,
>
>I simply wanna edit non Serializable domain objects in a html form. The
>
>Form should
>work for inserts (new objects) and updates. I created a
>LoadableDetachableModel for
>the given Domain which keeps a (database) id and has the following load
>
>method:
>
>@Override
>protected Testobject load() {
> if (DomainEntity.isPersistent(id)) {
> return Testobject.findOne(id);
> } else {
> return new Testobject();
> }
>}
>
>So if the id indicates persistence, the Testobject is loaded from the
>data source.
>If not, a new Testobject is created.
>
>I put this Model in a CompoundPropertyModel and everythings works fine.
>
>But I wonder if there are other solutions?
>
>Regards,
>Rene
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>For additional commands, e-mail: users-help@wicket.apache.org