Can you try to replicate what you're doing in a more simple fashion? Take your wicket framework code out of the mix. Just try a wicket/spring/hibernate example. You can use the Wicketopia example as a template if you want.
On Sat, Jun 4, 2011 at 6:01 AM, Gonzalo Aguilar Delgado <gagui...@aguilardelgado.com> wrote: > I removed transactional pointcuts to see if this removes the issue. > > But the problem got worse. It seems that something is really wrong > configured in my project. > > DEBUG - DefaultListableBeanFactory - Returning cached instance of > singleton bean 'leadDAOBean' > DEBUG - SessionFactoryUtils - Opening Hibernate Session > DEBUG - SessionImpl - opened session at timestamp: > 13071814596 > DEBUG - SessionFactoryUtils - Closing Hibernate Session > ERROR - RequestCycle - Can't instantiate page using > constructor public > org.apache.wicket.examples.wscaffold.basicform.BasicFormPage() > org.apache.wicket.WicketRuntimeException: Can't instantiate page using > constructor public > org.apache.wicket.examples.wscaffold.basicform.BasicFormPage() > > Watch this: > SessionFactoryUtils - Opening Hibernate Session > > It seems that is not the OSIV filter. It's hibernate who opens the > session. Why? > > It's strange because OSIV is configured: > DEBUG - OpenSessionInViewFilter - Initializing filter > 'openSessionInViewFilter' > DEBUG - OpenSessionInViewFilter - Filter 'openSessionInViewFilter' > configured successfully > > And the problem got worse without transactions: > > WicketMessage: Can't instantiate page using constructor public > org.apache.wicket.examples.wscaffold.basicform.BasicFormPage() > > Root cause: > > org.hibernate.HibernateException: No Hibernate Session bound to thread, > and configuration does not allow creation of non-transactional one here > > Not even the first page is instantiated... > > Will search more... > > > > > > El sáb, 04-06-2011 a las 11:28 +0200, Gonzalo Aguilar Delgado escribió: >> >Hi, >> >are you sure your model is a LDM? >> >> Yes. Sure. Encapsulated by an CompoundPropertyModel. >> ------- >> new CompoundPropertyModel(scaffoldableModel) >> ------- >> /* >> * Need this because wicket serializes everything and need to >> reload >> it when >> * it's needed. This way wicket and hibernate plays well >> */ >> IModel<Lead> scaffoldableModel = new >> LoadableHibernateModelImpl<Lead>(getFirst()) >> { >> /** >> * >> */ >> private static final long serialVersionUID = 1L; >> @SpringBean(name = "leadDAOBean") >> private LeadDAO leadDAO; >> private UuidUserType uuid; >> >> @Override >> protected Lead load() { >> Lead lead = null; >> if(uuid!=null) >> { >> lead = leadDAO.find(uuid); >> >> } >> return lead; >> } >> >> @Override >> protected void setNonTransientObject() { >> Lead lead = this.getObject(); >> if(lead!=null) >> uuid = lead.getUuid(); >> } >> >> >> }; >> >> -------- >> And... >> --------- >> public abstract class LoadableHibernateModelImpl<T> extends >> LoadableDetachableModel<T> >> implements LoadableHibernateModel<T>, IModel<T> >> --------- >> >> detach and load got called. So it's working. The problem seems to be >> transactions. >> >> I used to reload the model in the onBeforeRender functions. This made >> wicked open a transaction that continued until the save. But now I made >> things different (more efficient). The problem now is how to get a >> transaction run during the model update and save. >> >> >> >> >>IIRC you have a ListView involved. What's the type of >> >>this.getDefaultModel() ? >> >> I checked this to make sure is the correct model. What I do is to set a >> wrapper around. The component I use extends from panel and inside there >> is a form and some other components that must use the model of the >> panel. So I wrap it around with CompoundPropertyModel. >> >> --------------- >> public ScaffoldingForm(String id, IModel<T> scaffoldableModel) { >> //super(id, scaffoldableModel); >> super(id, new CompoundPropertyModel(scaffoldableModel)); >> --------------- >> >> The returning model is the CompoundPropertyModel. So seems to be ok. >> >> >> Thank you in advance Sven. >> I will try to make everything run in a unique transaction. I found this: >> http://apache-wicket.1842946.n4.nabble.com/OpenSessionInView-OSIV-LoadableDetachableModel-and-Transactions-td1858513.html >> >> Maybe someone else have any other useful link. >> >> Thank you again. >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org >> For additional commands, e-mail: users-h...@wicket.apache.org >> > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org