-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Does work @ManyToMany(fetch = FetchType.EAGER)?
PostPosted: Fri Jun 24, 2011 5:37 am 
Newbie

Joined: Thu May 05, 2011 6:33 am
Posts: 16
I have annotated a relation as follow
Code:
   @ManyToMany(fetch = FetchType.EAGER)
   @MapKeyColumn(name = "E_TPSISDK_K_ORDINAMENTO")
   @JoinTable(name = "V_DCM_TYPE_CLASS", joinColumns = {
         @JoinColumn(name = "K_DOCUMENTO_AZIENDALE", referencedColumnName = "K_DOCUMENTO_AZIENDALE"),
         @JoinColumn(name = "K_SOTTO_APPLICAZIONE", referencedColumnName = "K_SOTTO_APPLICAZIONE") }, inverseJoinColumns = {
         @JoinColumn(name = "K_CLASSE_DOCUMENTALE", referencedColumnName = "K_CLASSE_DOCUMENTALE"),
         @JoinColumn(name = "N_FOLDER_DOCUMENTO", referencedColumnName = "N_FOLDER_DOCUMENTO") })
   private Map<SystemId, DocumentClass> docClassMap = new HashMap<SystemId, DocumentClass>();


When I use Hessian to Serialize the Entity which contains this relation, I always have:

Caused by: com.caucho.hessian.io.HessianFieldException: it.nacon.gedi.typeregistry.domain.DocumentType.docClassMap: java.util.Map cannot be assigned from null
at com.caucho.hessian.io.JavaDeserializer.logDeserializeError(JavaDeserializer.java:677) ~[hessian-3.2.0.jar:na]
at com.caucho.hessian.io.JavaDeserializer$ObjectFieldDeserializer.deserialize(JavaDeserializer.java:400) ~[hessian-3.2.0.jar:na]
at com.caucho.hessian.io.JavaDeserializer.readObject(JavaDeserializer.java:233) ~[hessian-3.2.0.jar:na]
at com.caucho.hessian.io.JavaDeserializer.readObject(JavaDeserializer.java:157) ~[hessian-3.2.0.jar:na]
at com.caucho.hessian.io.SerializerFactory.readObject(SerializerFactory.java:378) ~[hessian-3.2.0.jar:na]
at com.caucho.hessian.io.Hessian2Input.readObjectInstance(Hessian2Input.java:2051) ~[hessian-3.2.0.jar:na]
at com.caucho.hessian.io.Hessian2Input.readObject(Hessian2Input.java:1977) ~[hessian-3.2.0.jar:na]
at com.caucho.hessian.io.Hessian2Input.readObject(Hessian2Input.java:1969) ~[hessian-3.2.0.jar:na]
at com.caucho.hessian.io.CollectionDeserializer.readList(CollectionDeserializer.java:78) ~[hessian-3.2.0.jar:na]
at com.caucho.hessian.io.Hessian2Input.readObject(Hessian2Input.java:1700) ~[hessian-3.2.0.jar:na]
at com.caucho.hessian.client.HessianProxy.invoke(HessianProxy.java:220) ~[hessian-3.2.0.jar:na]
at $Proxy71.getTypes(Unknown Source) ~[na:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_21]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[na:1.6.0_21]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_21]
at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_21]
at org.springframework.remoting.caucho.HessianClientInterceptor.invoke(HessianClientInterceptor.java:222) ~[spring-web-3.0.4.RELEASE.jar:3.0.4.RELEASE]
... 61 common frames omitted
Caused by: org.hibernate.LazyInitializationException: failed to lazily initialize a collection, no session or session was closed

Why Hibernate try a lazy inizialization of this collection?

_________________
Luca Preziati


Top
 Profile  
 
 Post subject: Re: Does work @ManyToMany(fetch = FetchType.EAGER)?
PostPosted: Wed Nov 21, 2012 8:05 am 
Newbie

Joined: Wed Dec 19, 2007 6:49 am
Posts: 8
Location: London
Did you ever find a solution to this? I have exactly the same error when using Hessian.

Many thanks.


Top
 Profile  
 
 Post subject: Re: Does work @ManyToMany(fetch = FetchType.EAGER)?
PostPosted: Thu Nov 22, 2012 7:18 am 
Newbie

Joined: Thu May 05, 2011 6:33 am
Posts: 16
Before Serializing with Hessian we remove all hibernate thing.

So, we take all element and we remove Hibernate List and Hibernate Map, but, moreover we scroll all element, so are inizialize. But this is not the solution, is a solution for bypassing the problem.

We do it bacause we cache all that data, and quite never change, one time per month.

_________________
Luca Preziati


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.