mephiztophelez
Grünschnabel
Hallo,
ich habe eine Methode addProductToShoppingCart(int productID)
in der ich wiederrum eine andere Methode this.isProductInCart(int productID) aufrufe.
Diese this.isProductInCart(int productID) Methode schaut ob das Produkt schon im warenkorb ist und liefert true falls ja.
Nun nutzt diese Methode auch Hibernate und schliesst am Ende die Session, so dass ich in
addProductToShoppingCart(int productID) diesen "Session is Closed" error bekomme.
Wie umgehe ich, dass die Session durch eine andere Methode geschlossen wird?
Danke
Christoph
ich habe eine Methode addProductToShoppingCart(int productID)
in der ich wiederrum eine andere Methode this.isProductInCart(int productID) aufrufe.
Diese this.isProductInCart(int productID) Methode schaut ob das Produkt schon im warenkorb ist und liefert true falls ja.
Nun nutzt diese Methode auch Hibernate und schliesst am Ende die Session, so dass ich in
addProductToShoppingCart(int productID) diesen "Session is Closed" error bekomme.
Code:
1:20:09,985 INFO [STDOUT] net.sf.hibernate.HibernateException: Session is closed
at net.sf.hibernate.impl.SessionImpl.connection(SessionImpl.java:3292)
at net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:63)
at de.christoph.shop.bl.ShopManager.addToCart(ShopManager.java:488)
at com.christoph.shop.struts.action.ProductDetailsAction.addtocartProduct(ProductDetailsAction.java:96)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Danke
Christoph