Is this the correct construction of a LDM where I need to use a service bean to
access my database? The IMyService bean is injected on the page and passed to
the LDM. Does this make the LDM hold a reference to the IMyService bean and
possibly keep a connection from being put back into the c3p0 db connection
pool? After some period of time my application is blocked with all threads
waiting on a connection to the db.
Should I be injected the IMyService bean into the LDM using the commented out
code. Thanks for any help.
public class MyLDM extends LoadableDetachableModel<com.example.MyObject> {
//@SpringBean
private IMyService service;
private String id;
public MyLDM(String id, IMyService service) {
this.id = id;
this.service = service;
}
//public MyLDM(String id) {
// this.id = id;
//}
@Override
protected com.example.MyObject load() {
//InjectorHolder.getInjector().inject(this);
return service.getMyObject(this.id);
}
}