You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Marek Šabo <ms...@buk.cvut.cz> on 2010/10/22 02:10:56 UTC
Check on LoadabledetachableModel
Hi,
I just want to ask if get the ldm concept right in my code:
SortableDataProvider for DataTable:
@Override
public IModel<User> model(final User object) { //user is a
JPA entity
return new LoadableDetachableModel<User>(object) {
private static final long serialVersionUID = 1L;
@Override
protected User load() {
LoggerFactory.getLogger(this.getClass()).debug("should be loading {}",
object);
return new
UserJpaController().findUser(object.getId());
}
};
}
The DataTable then uses PropertyColumns to get the values. Is this
right? Because I'm 40:60 sure it ain't.
Regards,
--
Marek Šabo
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Check on LoadabledetachableModel
Posted by Marek Šabo <ms...@buk.cvut.cz>.
Thanks,
seems to work as it's supposed to now. Just for the record,
de-implementing the Serializable interface from entities/objects is a
good hint whether the object was undergoing the serialization process (a
spam of NotSerializableExceptions will follow).
Regards,
--
Marek Šabo
On 10/22/2010 04:21 AM, Jeremy Thomerson wrote:
> By referencing the object within the LDM, you've made the compiler put a
> reference to it in your LDM class, which means it will now be serialized.
> Take the final off the user object and do:
>
> final int id = object.getID() so that only the id is serialized.
>
> Jeremy Thomerson
> http://wickettraining.com
> -- sent from my "smart" phone, so please excuse spelling, formatting, or
> compiler errors
>
> On Oct 21, 2010 7:26 PM, "Marek Šabo"<ms...@buk.cvut.cz> wrote:
>
> Hi,
>
> I just want to ask if get the ldm concept right in my code:
>
> SortableDataProvider for DataTable:
>
> @Override
> public IModel<User> model(final User object) { //user is a JPA
> entity
> return new LoadableDetachableModel<User>(object) {
>
> private static final long serialVersionUID = 1L;
>
> @Override
> protected User load() {
> LoggerFactory.getLogger(this.getClass()).debug("should be
> loading {}", object);
> return new UserJpaController().findUser(object.getId());
> }
> };
> }
>
> The DataTable then uses PropertyColumns to get the values. Is this right?
> Because I'm 40:60 sure it ain't.
>
> Regards,
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Check on LoadabledetachableModel
Posted by Jeremy Thomerson <je...@wickettraining.com>.
By referencing the object within the LDM, you've made the compiler put a
reference to it in your LDM class, which means it will now be serialized.
Take the final off the user object and do:
final int id = object.getID() so that only the id is serialized.
Jeremy Thomerson
http://wickettraining.com
-- sent from my "smart" phone, so please excuse spelling, formatting, or
compiler errors
On Oct 21, 2010 7:26 PM, "Marek Šabo" <ms...@buk.cvut.cz> wrote:
Hi,
I just want to ask if get the ldm concept right in my code:
SortableDataProvider for DataTable:
@Override
public IModel<User> model(final User object) { //user is a JPA
entity
return new LoadableDetachableModel<User>(object) {
private static final long serialVersionUID = 1L;
@Override
protected User load() {
LoggerFactory.getLogger(this.getClass()).debug("should be
loading {}", object);
return new UserJpaController().findUser(object.getId());
}
};
}
The DataTable then uses PropertyColumns to get the values. Is this right?
Because I'm 40:60 sure it ain't.
Regards,
--
Marek Šabo
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org