On 7/16/06, Iman Rahmatizadeh <[EMAIL PROTECTED]> wrote:
> The problem with #1 is, first its a bit ugly,

Working with objects directly is always the nicest of course. In many
cases, where you just have to display some read-only information, you
don't really need to pass the model all the time actually, as often
new Label("person", person.getName()) would suffice.

> second you discard every
> persistent instance in each cycle (which is less efficient than #2 or
> #3)

I don't think it is *that* less efficient. Attaching those objects
likely means refreshing them too, so the only gain you would have is
the creation of objects, and those few instances wouldn't even be
noticable, while the extra session size of #2 might be.

>, third you lose the advantages of working & passing POJO's between
> pages, Like you would call 'new ProfilePage(person.getId())' instead of
> 'new ProfilePage(person))'

True for 1.2, but for 2.0, like Igor said: public
EditPersonPanel(IModel<Person> personModel)

There you pass in a strongly typed model: Person p =
personModel.getObject(); would return the already loaded persistent
object in the same request. So wherever you reuse the model, you'd
only load once a request.

> Still if anybody has any experience with #2 or #3, I would
> be happy to know about it.

Did you try to make a generic model for what you want? That model
should be able to access the current hibernate session, and on attach,
where #1models load using the id set in that model, here they would
just refresh the object they have.


Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
Wicket-user mailing list

Reply via email to