I am working on a Wicket-based web app on Java EE.
I am trying to find a way to ensure that any entities used as model objects are always attached to the current EntityM
Seems to be kindof an old post..
I hope it will help some others anyway:
First: Your LDM is a bit useless, because the entity property is not transient. Therefore your entity gets serialised to your session store and thats not the meaning of an LDM. It's supposed to minimize the serialization size of any modeldata.
Second: Your problem isn't a real problem, cause what you need, is what you already have: You want to prepare an Entity over several pages to be finally stored in your database (some wizard or so..). Now, that your LDM is fully serialized to your session store between the requests of the client, your entity and its edited data survives multiple requests, no need for any merging. As soon, as your wizard is finished, you simply persist the hole entity. Before the entity is in its final state, it doesn't make sense to persist anything (though it survives over requests in your session store).
You don't even need the LDM for this kind of funcionality..
Simply give the entity as parameter to the next page, where the user may complete its data.
Hope you solved this problem already..
I cases like this I usually create a DTO keeping all the data I need to create an entity. If you need to reference existing entities - pass them to your forms/panels as separate models. When the form is submitted you can then:
It's a bit of hassle but does actually work.
Conversations spanning multiple requests are not available in pure wicket and probably will never be - this is not wicket's area.
Seam supports long conversations and it does support wicket (I have never used seam - I cannot advice you on this one).