Gibt es eine Art OpenSessionInViewInterceptor auch für Swing

Romsl

Erfahrenes Mitglied
Hi,

ich verwende Hibernate im Zusammenhang mit Swing. Jetzt weiß ich, dass es in Spring beispielsweise einen OpenSessionInViewInterceptor gibt. Aber was mache ich in Swing.

Dort bekomme ich ständig eine Exception

Code:
org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: ecobill.module.base.domain.BusinessPartner.bills - no session or session was closed
   at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:191)
   at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:183)
   at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:48)
   at org.hibernate.collection.PersistentSet.equals(PersistentSet.java:319)
   at ecobill.module.base.domain.BusinessPartner.equals(BusinessPartner.java:207)
   at test.PersistenceTest.testBusinessPartner(PersistenceTest.java:216)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at com.intellij.rt.execution.junit2.JUnitStarter.main(JUnitStarter.java:31)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at com.intellij.rt.execution.application.AppMain.main(AppMain.java:86)

Danke
 
Zurück