Thank you all for your replies, very helpful!

Sven Meier <s...@meiers.net<mailto:s...@meiers.net>> wrote:

>detachable models should never use getObject() in their implementation of 
>equals()?

generally this is a good advice: there are several places in Wicket checking 
for model equality (e.g. ReuseIfModelsEqualStrategy).
A detachable model should have enough information to decide equality without 
loading the model object.

It would be good to note this somewhere in the documentation where model 
implementers will find it.

Ernesto Reinaldo Barreiro <reier...@gmail.com<mailto:reier...@gmail.com>> wrote:

Shouldn't the serialize "primary key"=the bit of info needed to recover
data on attach stored on LDM be the criteria for equality?

Yes, and I will look into changing our implementation to do this.  However it 
is more complicated, since our LDM [*] also supports constructing a model based 
on a query rather than an ID, or storing a not-persisted object directly, so 
we’d have to do considerably more than just compare IDs.  And you could have a 
query-based model and an ID-based model that resolve to the same object — it’s 
perhaps a philosophical question whether those ought to compare equal or not.  
The practical question, of course, is whether changing the definition of 
equality will break any existing code.

[*] we are using a version of the HibernateObjectModel from the 
no-longer-maintained Databinder (see 
https://github.com/n8han/Databinder-for-Wicket/ ) updated for wicket 6 and 
recent Hibernate versions.   BTW if anyone is interested in collaborating on 
maintaining and improving this library that mediates between Wicket & 
Hibernate, please get in touch.

Martin Grigorov <mgrigo...@apache.org<mailto:mgrigo...@apache.org>> wrote:

does 
org.apache.wicket.core.util.objects.checker.CheckingObjectOutputStream#check()
really need to use #equals() (via Stack#contains()) ?
I think checking for identity equality should be OK too

I was wondering the same thing; using identity would certainly be safer for 
issues like these.

Boris


Reply via email to