Well the reason the book leaves it open is that it really is up to you
how you get your DAOs. That has nothing to do with Wicket anymore and
depends wholly on your own preferences.
Regards,
Linda
David Chang wrote:
Hello, I am reading <<Wicket in Action>> to learn Wicket. The example on Page
99 is about teaching detachable models. Here it goes:
-----------
public class CheeseModel extends Model {
private Long id;
private transient Cheese cheese;
public CheeseModel() {
}
public CheeseModel(Cheese cheese) {
setObject(cheese);
}
public CheeseModel(Long id) {
this.id = id;
}
@Override
public Object getObject() {
if(cheese != null) return cheese;
if(id == null ) {
cheese = new Cheese();
} else {
CheeseDao dao = ...
cheese = dao.getCheese(id);
}
return cheese;
}
@Override
public void setObject(Object object) {
this. cheese = (Cheese)object;
id = (cheese == null) ? null : cheese.getId();
}
@Override
public void detach() {
this. cheese = null;
}
}
-----------
I would like to know how dao is obtained as indicated as follows:
CheeseDao dao = ...
Use a locator pattern? Or should I let CheeseModel extend a custom model in
which dao is set via Spring? Does the latter way create more memory footprint?
What are the effective ways of getting DAO avaiable to wicket models?
Thanks for your input!
Cheers!
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org
------------------------------------------------------------------------
No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.5.392 / Virus Database: 270.13.32/2266 - Release Date: 07/27/09 05:58:00
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org