With a remote client getting in touch with a serialized entity bean, I am getting a LazyInitializationException. Is this the right thing to do? it seems that the dynamic proxy is also been serialized, this way I need hibernate jars on client side. quite odd.
shouldn't only an EJB expcetion be thrown?
SEVERE: could not initialize proxy - no Session org.hibernate.LazyInitializationException: could not initialize proxy - no Session at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:53) at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:98) at org.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:158) at ejb3.Autor$$EnhancerByCGLIB$$dddbeaee.toString(<generated>) at java.lang.String.valueOf(Unknown Source) at java.lang.StringBuilder.append(Unknown Source) at ejb3.Livro.toString(Livro.java:49) at java.lang.String.valueOf(Unknown Source) at java.util.AbstractCollection.toString(Unknown Source) at java.lang.String.valueOf(Unknown Source) at java.io.PrintStream.print(Unknown Source) at java.io.PrintStream.println(Unknown Source) at ejb3.Cliente.main(Cliente.java:32) Exception in thread "main" org.hibernate.LazyInitializationException: could not initialize proxy - no Session at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:53) at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:98) at org.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:158) at ejb3.Autor$$EnhancerByCGLIB$$dddbeaee.toString(<generated>) at java.lang.String.valueOf(Unknown Source) at java.lang.StringBuilder.append(Unknown Source) at ejb3.Livro.toString(Livro.java:49)
An EJB exception will have to be thrown, but I don't think this will prevent you from having the Hibernate classes on the client side.