Group Members,
Is it possible to use the Hibernate 4 in one module and access through java beans the objects of other module using Hibernate 3 ? If yes ,I need urgent help for the following problem. I have the following project structure.
1.
CommonGlobal module which is using hibernate 3.2 with cglib which has manily the global objects which will be used in other modules. Here it is important to mention that this module working fine independently.
2.
MainModule which is using JPA 2.0 with hibernate 4.1. This module will use the BDO from
CommonGlobal module. I had done with the mapping in persistentence.xml like the following :-
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/ ... ce_2_0.xsd" version="2.0">
<persistence-unit name="main-jpa" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>MAINDS</jta-data-source>
<shared-cache-mode>NONE</shared-cache-mode>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.Oracle9Dialect" />
<property name="java.naming.factory.initial" value="weblogic.jndi.WLInitialContextFactory" />
<property name="hibernate.transaction.manager_lookup_class"
value="org.hibernate.transaction.WeblogicTransactionManagerLookup" />
<property name="hibernate.transaction.factory_class"
value="org.hibernate.transaction.CMTTransactionFactory"/>
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.archive.autodetection" value="class"/>
</properties>
</persistence-unit>
<persistence-unit name="COMMNPU" transaction-type="JTA">
<jta-data-source>COMMNDS</jta-data-source>
<properties>
<property name="hibernate.ejb.cfgfile" value="/pb-global-hibernate.cfg.xml" />
<property name="hibernate.archive.autodetection" value="" />
</properties>
</persistence-unit>
I had provided the hibernate jars which are compatible for that version of JPA 2 and that works fine for MAINModule BDOs fetching but when I go to fetch the objects from
COMMONMODULE, I am getting the following problem
<Jun 5, 2012 2:06:29 PM IST> <Notice> <Stdout> <BEA-000000> <2012-06-05 14:06:29,997 [[ACTIVE] ExecuteThread: '4' for queue: 'weblogic.kernel.Default (self-tuning)'] ERROR [org.hib
ernate.proxy.pojo.BasicLazyInitializer] - CGLIB Enhancement failed: com.global.FiscalYear
java.lang.NoSuchMethodError: org.hibernate.proxy.pojo.BasicLazyInitializer.<init>(Ljava/lang/String;Ljava/lang/Class;Ljava/io/Serializable;Ljava/lang/reflect/Method;Ljava/lang/refl
ect/Method;Lorg/hibernate/type/AbstractComponentType;Lorg/hibernate/engine/SessionImplementor;)V
at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.<init>(CGLIBLazyInitializer.java:134)
at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.getProxy(CGLIBLazyInitializer.java:50)
at org.hibernate.proxy.pojo.cglib.SerializableProxy.readResolve(SerializableProxy.java:55)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at java.io.ObjectStreamClass.invokeReadResolve(ObjectStreamClass.java:1061)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1761)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1946)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1870)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1752)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:350)
at weblogic.rmi.extensions.server.CBVInputStream.readObject(CBVInputStream.java:64)
at weblogic.rmi.internal.ServerRequest.unmarshalReturn(ServerRequest.java:100)
at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:348)
at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:259)
at com.PbsGlobalSettingFacadeBean_5a1pkc_EOImpl_1035_WLStub.getPeriodForDate(Unknown Source)
at com.sessionbeans.GLAdminFacadeBean.getPeriodForDate(GLAdminFacadeBean.java:157)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.bea.core.repackaged.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at com.bea.core.repackaged.springframework.jee.spi.MethodInvocationVisitorImpl.visit(MethodInvocationVisitorImpl.java:37)
at weblogic.ejb.container.injection.EnvironmentInterceptorCallbackImpl.callback(EnvironmentInterceptorCallbackImpl.java:54)
at com.bea.core.repackaged.springframework.jee.spi.EnvironmentInterceptor.invoke(EnvironmentInterceptor.java:50)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at com.bea.core.repackaged.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at com.bea.core.repackaged.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy79.getPeriodForDate(Unknown Source)
at com.GLAdminFacadeBean_fu501s_GLAdminFacadeImpl.__WL_invoke(Unknown Source)
at weblogic.ejb.container.internal.SessionRemoteMethodInvoker.invoke(SessionRemoteMethodInvoker.java:40)
at com.sessionbeans.GLAdminFacadeBean_fu501s_GLAdminFacadeImpl.getPeriodForDate(Unknown Source)
at com.sessionbeans.GLAdminFacadeBean_fu501s_GLAdminFacadeImpl_WLSkel.invoke(Unknown Source)
When I investigated , there is a signature change in BasicLazyInitializer class contsructor. Also hibernate should now use the javassist as hibernate.bytecode.provider. So what is the reason of this exception ?
An early help is appraciated. Please ignore my misspelled words if any.