Discussion:
Recommenced way of dealing with non Serializable Objects in Forms
René Stolle
2018-08-02 16:00:05 UTC
Permalink
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-***@wicket.apache.org
For additional commands, e-mail: users-***@wicket.apache.org
Sven Meier
2018-08-02 16:22:12 UTC
Permalink
Hi,

that's perfectly fine.

Why are you looking for another solution?

Have fun
Sven
Post by René Stolle
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
@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
---------------------------------------------------------------------
rstolle
2018-08-03 08:21:46 UTC
Permalink
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
Post by 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"
Post by René Stolle
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
@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-***@wicket.apache.org
For additional commands, e-mail: users-***@wicket.apache.org

Loading...