Hi,
I was facing lazyinitialization problem and used OpenSessionInViewFilter to avoid it. This worked in some places but failed in others. All the errors come
in the hashCode() method that I have implemented in my POJO's. These come for the objects which are retreived as Lazy.
I have a basic question which may be very stupid, but please bear with me.
Can I change the hashCode() method to include only those objects that are not fetched lazily? What would be the side effects in such a case?
Could any one please help me with this? Am stuck with this problem for a long time now.
Thanks
Error Trace That I am getting
------------
org.hibernate.LazyInitializationException: could not initialize proxy - no Session
at org.hibernate.proxy.AbstractLazyInitializer.initia lize(AbstractLazyInitializer.java:57)
at org.hibernate.proxy.AbstractLazyInitializer.getImp lementation(AbstractLazyInitializer.java:111)
at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitialize r.invoke(CGLIBLazyInitializer.java:150)
at com.cpt.his.model.ICPCategory$$EnhancerByCGLIB$$a8 a4fd72.hashCode(<generated>)
at org.apache.commons.lang.builder.HashCodeBuilder.ap pend(HashCodeBuilder.java:856)
at com.cpt.his.model.ICP.hashCode(ICP.java:175)
at java.util.HashMap.hash(HashMap.java:264)
at java.util.HashMap.put(HashMap.java:382)
at java.util.HashSet.add(HashSet.java:194)
at org.apache.commons.lang.builder.ToStringStyle.regi ster(ToStringStyle.java:151)
at org.apache.commons.lang.builder.ToStringStyle.appe ndClassName(ToStringStyle.java:1403)
at org.apache.commons.lang.builder.ToStringStyle.appe ndStart(ToStringStyle.java:328)
at org.apache.commons.lang.builder.ToStringBuilder.<i nit>(ToStringBuilder.java:255)
at org.apache.commons.lang.builder.ToStringBuilder.<i nit>(ToStringBuilder.java:212)
at com.cpt.his.model.ICP.toString(ICP.java:184)
at ognl.OgnlOps.stringValue(OgnlOps.java:285)
at ognl.OgnlOps.stringValue(OgnlOps.java:302)
at ognl.OgnlOps.convertValue(OgnlOps.java:367)


Reply With Quote
