As workaround for now I am doing this, but are a very ugly way:
2010/5/31 nino martinez wael <[email protected]>: > Okay tried moving the @Inject from the setter to the field > declaration, still not working. Tried to add the keyword transient to > the field, still not working :/ Im a little lost here for once.. > Remember it's only when my loadable detachable models are called the > 2nd time, on first load it works.. The injector part of the ldms look > like this, and im on wicket 1.4.9: > > import org.apache.wicket.injection.web.InjectorHolder; > > import com.google.inject.Inject; > import com.netdesign.codan.dao.PhoneDao; > > public class ClassWithDao { > > public ClassWithDao() { > > InjectorHolder.getInjector().inject(this); > } > > �...@inject > private transient PhoneDao phoneDao; > > public PhoneDao getPhoneDao() { > return phoneDao; > } > > public void setPhoneDao(PhoneDao phoneDao) { > this.phoneDao = phoneDao; > } > > } > > > 2010/5/28 nino martinez wael <[email protected]>: >> Hi Guys >> >> I wanted to try out the now working wicket injector holder for my >> webapp. But I keep getting: >> "java.lang.IllegalStateException: EntityManager is closed >> at >> org.hibernate.ejb.EntityManagerImpl.getSession(EntityManagerImpl.java:66) >> at >> org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:93)" >> >> I've traced it so far that it's not an issue with page creation or >> page reloads. But seems to be when my detachablemodels or >> datasources(inmethod) are being loaded. It's like the entity manager >> gets closed after a request and never opened again. >> >> I followed this guide: >> http://www.atomicgamer.com/dev/2009/10/wicket-guice-2-0-warp-persist-2-0/ >> >> web.xml looks like this: >> >> <filter> >> <filter-name>warpPersistFilter</filter-name> >> >> <filter-class>com.wideplay.warp.persist.PersistenceFilter</filter-class> >> </filter> >> >> <filter-mapping> >> <filter-name>warpPersistFilter</filter-name> >> <url-pattern>/*</url-pattern> >> </filter-mapping> >> >> <filter-mapping> >> <filter-name>wicket.WicketWarp</filter-name> >> <url-pattern>/*</url-pattern> >> </filter-mapping> >> >> And my warpmodule like this: >> >> Module warpModule = PersistenceService.usingJpa().across( >> UnitOfWork.REQUEST).forAll( >> Matchers.annotatedWith(Transactional.class), >> Matchers.any()) >> .buildModule(); >> >> WicketApplication: >> �...@override >> protected void init() { >> super.init(); >> addComponentInstantiationListener(new >> GuiceComponentInjector(this, >> getGuiceInjector())); >> } >> protected Injector getGuiceInjector() { >> return Guice.createInjector(new Module()); >> } >> >> >> In advance thanks, and please ask if I forgot something. Otherwise I >> have to roll back and ask a singleton for the dao each time and that >> would be really undesirable. >> >> -Nino >> > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
