Hi Himadri,
Can you please add :
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
to your persistence.xml and see if you are still able to replicate the
issue.
Also it would be great if you can share your client code with me, so I can
replicate the issue.
Regards,
Ravi.
Himadri wrote:
>
> So sorry .. attached the wrong one .. Please see the correct one here.If I
> run the junit , I get this exception "javax.ejb.EJBException: EJB
> Exception: ; nested exception is:
> <openjpa-1.1.0-r422266:657916 nonfatal general error>
> org.apache.openjpa.persistence.PersistenceException: [BEA][Oracle JDBC
> Driver][Oracle]ORA-01790: expression must have same datatype as
> corresponding expression
> {prepstmnt 2625 SELECT 0, t0.ID, t0.version, t0.master_Ref, t0.NAME_F,
> '', 0, NULL, '', 0, 0, '1970-01-01', '', 0.0 FROM AddOn_T t0 WHERE t0.ID =
> ? UNION ALL SELECT 1, t0.ID, t0.version, t0.addOn_Ref, t0.NAME_F, '', 0,
> NULL, '', 0, 0, '1970-01-01', '', 0.0 FROM Master_T t0 WHERE t0.ID = ?
> UNION ALL SELECT 2, t0.ID, t0.version, t0.NAME_F, t0.primaryMaster_Ref,
> t0.secondaryMaster_Ref, 0, NULL, '', 0, 0, '1970-01-01', '', 0.0 FROM
> Slave_T t0 WHERE t0.ID = ? UNION ALL SELECT 3, t0.ID, t0.version,
> t0.addOn_Ref, t0.NAME_F, '', 0, NULL, '', 0, 0, '1970-01-01', '', 0.0 FROM
> SubAddOn_T t0 WHERE t0.ID = ? UNION ALL SELECT 4, t0.ID, t0.version,
> t0.NAME_F, t0.slave_Ref, '', 0, NULL, '', 0, 0, '1970-01-01', '', 0.0 FROM
> SubSlave_T t0 WHERE t0.ID = ? UNION ALL SELECT 5, t0.ID, t0.version, '',
> '', '', t0.COUNTER_F, t0.DATA_F, t0.ENUMED1_F, t0.ENUMED2_F, t0.FLAG_F,
> t0.MOMENT_F, t0.NAME_F, t0.VALUE_F FROM TYPED_T t0 WHERE t0.ID = ?
> [params=(String) 34B85860E33211DE984DF2390A53043A, (String)
> 34B85860E33211DE984DF2390A53043A, (String)
> 34B85860E33211DE984DF2390A53043A, (String)
> 34B85860E33211DE984DF2390A53043A, (String)
> 34B85860E33211DE984DF2390A53043A, (String)
> 34B85860E33211DE984DF2390A53043A]} [code=1790, state=HY000]
> at
> weblogic.ejb.container.internal.RemoteBusinessIntfProxy.unwrapRemoteException(RemoteBusinessIntfProxy.java:105)
> at
> weblogic.ejb.container.internal.RemoteBusinessIntfProxy.invoke(RemoteBusinessIntfProxy.java:87)
> at $Proxy0.testType(Unknown Source)
> at com.tieto.magic.poc.test.TestSample.testP(TestSample.java:54)
> 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 junit.framework.TestCase.runTest(TestCase.java:168)
> at junit.framework.TestCase.runBare(TestCase.java:134)
> at junit.framework.TestResult$1.protect(TestResult.java:110)
> at junit.framework.TestResult.runProtected(TestResult.java:128)
> at junit.framework.TestResult.run(TestResult.java:113)
> at junit.framework.TestCase.run(TestCase.java:124)
> at junit.framework.TestSuite.runTest(TestSuite.java:232)
> at junit.framework.TestSuite.run(TestSuite.java:227)
> at
> org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:81)
> at
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
> at
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
> Caused by: <openjpa-1.1.0-r422266:657916 nonfatal general error>
> org.apache.openjpa.persistence.PersistenceException: [BEA][Oracle JDBC
> Driver][Oracle]ORA-01790: expression must have same datatype as
> corresponding expression
> {prepstmnt 2625 SELECT 0, t0.ID, t0.version, t0.master_Ref, t0.NAME_F,
> '', 0, NULL, '', 0, 0, '1970-01-01', '', 0.0 FROM AddOn_T t0 WHERE t0.ID =
> ? UNION ALL SELECT 1, t0.ID, t0.version, t0.addOn_Ref, t0.NAME_F, '', 0,
> NULL, '', 0, 0, '1970-01-01', '', 0.0 FROM Master_T t0 WHERE t0.ID = ?
> UNION ALL SELECT 2, t0.ID, t0.version, t0.NAME_F, t0.primaryMaster_Ref,
> t0.secondaryMaster_Ref, 0, NULL, '', 0, 0, '1970-01-01', '', 0.0 FROM
> Slave_T t0 WHERE t0.ID = ? UNION ALL SELECT 3, t0.ID, t0.version,
> t0.addOn_Ref, t0.NAME_F, '', 0, NULL, '', 0, 0, '1970-01-01', '', 0.0 FROM
> SubAddOn_T t0 WHERE t0.ID = ? UNION ALL SELECT 4, t0.ID, t0.version,
> t0.NAME_F, t0.slave_Ref, '', 0, NULL, '', 0, 0, '1970-01-01', '', 0.0 FROM
> SubSlave_T t0 WHERE t0.ID = ? UNION ALL SELECT 5, t0.ID, t0.version, '',
> '', '', t0.COUNTER_F, t0.DATA_F, t0.ENUMED1_F, t0.ENUMED2_F, t0.FLAG_F,
> t0.MOMENT_F, t0.NAME_F, t0.VALUE_F FROM TYPED_T t0 WHERE t0.ID = ?
> [params=(String) 34B85860E33211DE984DF2390A53043A, (String)
> 34B85860E33211DE984DF2390A53043A, (String)
> 34B85860E33211DE984DF2390A53043A, (String)
> 34B85860E33211DE984DF2390A53043A, (String)
> 34B85860E33211DE984DF2390A53043A, (String)
> 34B85860E33211DE984DF2390A53043A]} [code=1790, state=HY000]
> at
> org.apache.openjpa.jdbc.sql.SQLExceptions.narrow(SQLExceptions.java:146)
> at
> org.apache.openjpa.jdbc.sql.DBDictionary.newStoreException(DBDictionary.java:4150)
> at
> org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:102)
> at
> org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:88)
> at
> org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:64)
> at
> org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initialize(JDBCStoreManager.java:268)
> at
> org.apache.openjpa.kernel.DelegatingStoreManager.initialize(DelegatingStoreManager.java:111)
> at
> org.apache.openjpa.datacache.DataCacheStoreManager.initialize(DataCacheStoreManager.java:336)
> at
> org.apache.openjpa.kernel.DelegatingStoreManager.initialize(DelegatingStoreManager.java:111)
> at
> org.apache.openjpa.kernel.ROPStoreManager.initialize(ROPStoreManager.java:57)
> at org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:894)
> at kodo.kernel.KodoBroker.initialize(KodoBroker.java:65)
> at org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:852)
> at org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:769)
> at kodo.kernel.KodoBroker.find(KodoBroker.java:232)
> at
> org.apache.openjpa.kernel.DelegatingBroker.find(DelegatingBroker.java:183)
> at
> org.apache.openjpa.persistence.EntityManagerImpl.find(EntityManagerImpl.java:452)
> 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
> weblogic.deployment.BasePersistenceContextProxyImpl.invoke(BasePersistenceContextProxyImpl.java:90)
> at
> weblogic.deployment.TransactionalEntityManagerProxyImpl.invoke(TransactionalEntityManagerProxyImpl.java:89)
> at
> weblogic.deployment.BasePersistenceContextProxyImpl.invoke(BasePersistenceContextProxyImpl.java:80)
> at
> weblogic.deployment.TransactionalEntityManagerProxyImpl.invoke(TransactionalEntityManagerProxyImpl.java:24)
> at $Proxy140.find(Unknown Source)
> at
> com.tieto.magic.poc.domain.DomainServicesBean.testType(DomainServicesBean.java:48)
> 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:281)
> at
> com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:187)
> at
> com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:154)
> at
> com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:126)
> at
> com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:114)
> at
> com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
> at
> com.bea.core.repackaged.springframework.jee.spi.MethodInvocationVisitorImpl.visit(MethodInvocationVisitorImpl.java:15)
> at
> weblogic.ejb.container.injection.EnvironmentInterceptorCallbackImpl.callback(EnvironmentInterceptorCallbackImpl.java:54)
> at
> com.bea.core.repackaged.springframework.jee.spi.EnvironmentInterceptor.invoke(EnvironmentInterceptor.java:30)
> at
> com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
> 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:176)
> at
> com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:126)
> at
> com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:114)
> at
> com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
> at
> com.bea.core.repackaged.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:210)
> at $Proxy142.testType(Unknown Source)
> at
> com.tieto.magic.poc.domain.DomainServicesBean_au5mn8_DomainServicesRImpl.testType(DomainServicesBean_au5mn8_DomainServicesRImpl.java:65)
> at
> com.tieto.magic.poc.domain.DomainServicesBean_au5mn8_DomainServicesRImpl_WLSkel.invoke(Unknown
> Source)
> at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:589)
> at
> weblogic.rmi.cluster.ClusterableServerRef.invoke(ClusterableServerRef.java:230)
> at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:477)
> at
> weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
> at weblogic.security.service.SecurityManager.runAs(Unknown Source)
> at
> weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:473)
> at
> weblogic.rmi.internal.wls.WLSExecuteRequest.run(WLSExecuteRequest.java:118)
> at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
> at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
> Caused by: java.lang.Exception:
> org.apache.openjpa.lib.jdbc.ReportingSQLException: [BEA][Oracle JDBC
> Driver][Oracle]ORA-01790: expression must have same datatype as
> corresponding expression
> {prepstmnt 2625 SELECT 0, t0.ID, t0.version, t0.master_Ref, t0.NAME_F,
> '', 0, NULL, '', 0, 0, '1970-01-01', '', 0.0 FROM AddOn_T t0 WHERE t0.ID =
> ? UNION ALL SELECT 1, t0.ID, t0.version, t0.addOn_Ref, t0.NAME_F, '', 0,
> NULL, '', 0, 0, '1970-01-01', '', 0.0 FROM Master_T t0 WHERE t0.ID = ?
> UNION ALL SELECT 2, t0.ID, t0.version, t0.NAME_F, t0.primaryMaster_Ref,
> t0.secondaryMaster_Ref, 0, NULL, '', 0, 0, '1970-01-01', '', 0.0 FROM
> Slave_T t0 WHERE t0.ID = ? UNION ALL SELECT 3, t0.ID, t0.version,
> t0.addOn_Ref, t0.NAME_F, '', 0, NULL, '', 0, 0, '1970-01-01', '', 0.0 FROM
> SubAddOn_T t0 WHERE t0.ID = ? UNION ALL SELECT 4, t0.ID, t0.version,
> t0.NAME_F, t0.slave_Ref, '', 0, NULL, '', 0, 0, '1970-01-01', '', 0.0 FROM
> SubSlave_T t0 WHERE t0.ID = ? UNION ALL SELECT 5, t0.ID, t0.version, '',
> '', '', t0.COUNTER_F, t0.DATA_F, t0.ENUMED1_F, t0.ENUMED2_F, t0.FLAG_F,
> t0.MOMENT_F, t0.NAME_F, t0.VALUE_F FROM TYPED_T t0 WHERE t0.ID = ?
> [params=(String) 34B85860E33211DE984DF2390A53043A, (String)
> 34B85860E33211DE984DF2390A53043A, (String)
> 34B85860E33211DE984DF2390A53043A, (String)
> 34B85860E33211DE984DF2390A53043A, (String)
> 34B85860E33211DE984DF2390A53043A, (String)
> 34B85860E33211DE984DF2390A53043A]} [code=1790, state=HY000]
> at
> org.apache.openjpa.util.Exceptions.replaceNestedThrowables(Exceptions.java:249)
> at
> org.apache.openjpa.persistence.PersistenceException.writeObject(PersistenceException.java:100)
> 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.invokeWriteObject(ObjectStreamClass.java:945)
> at
> java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1461)
> at
> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
> at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
> at
> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
> at
> java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
> at
> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
> at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
> at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
> at
> weblogic.rjvm.MsgAbbrevOutputStream.writeObject(MsgAbbrevOutputStream.java:618)
> at
> weblogic.rjvm.MsgAbbrevOutputStream.sendThrowable(MsgAbbrevOutputStream.java:471)
> at
> weblogic.rmi.internal.BasicServerRef.handleThrowable(BasicServerRef.java:694)
> at
> weblogic.rmi.internal.BasicServerRef.postInvoke(BasicServerRef.java:650)
> at
> weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:492)
> ... 3 more
>
> "
>
> http://n2.nabble.com/file/n4138239/SampleEJBEar.ear SampleEJBEar.ear
>
> Ravi P Palacherla wrote:
>>
>> Looks like the SampleEJB.ear in the attachment is not a correct ear.
>> I am unable to deploy it on Weblogic server.
>>
>> Also the configuration files (like persistence.xml) and entities are
>> missing in the attachment without which I may not be able to tell what
>> configuration you are using.
>>
>> Are you using openJPA configurations or kodo configurations ?
>> There was a known issue with a CLOB data type when kodo configuration is
>> used.
>> The fix for this is in kodo files, it overrides openJPA's classes in
>> order to fix it.
>>
>> Before going into details of the fix, Please attach a replicable
>> testcase.
>> That way I can see if the same fix applies for your scenario or not.
>>
>> It would be great if you are able to replicate the issue with openJPA
>> configuration itself; we can work together on resolving the issue in
>> openJPA itself.
>>
>> Also there were some workarounds of setting
>> "SubclassFetchMode=none";which I would not completely recommend with out
>> understanding your complete environment.
>>
>> Regards,
>> Ravi.
>>
>>
>> himadri wrote:
>>>
>>>
>>>
>>> Hi,
>>>
>>> This is strange. The problem comes when I add Child Associations to the
>>> entity. If I remove Child Asscoiations , all work fine. I have attached
>>> my Sample here.
>>> Please see JPG for Entity Associations. SampleEJB.ear is the deployable
>>> ear on WL10.3.
>>>
>>> Let me know if you find out anything .. for now I have replace all
>>> em.find with em.createQuery(Select ...) , But will like to know the real
>>> reason behind it !
>>>
>>> Lemme know if I can provide more simplified sample ....
>>>
>>> Thanks,
>>> Himadri
>>>
>>>
>>> ________________________________
>>> From: Kevin Sutter [via OpenJPA]
>>> <[email protected]>
>>> To: himadri <[email protected]>
>>> Sent: Thu, 3 December, 2009 5:39:17 AM
>>> Subject: Re: Open JPA generates incorrect Union All for Date and Boolean
>>> Datatype
>>>
>>> This sounds very strange. From your description, I have no idea why
>>> Date
>>> and Boolean attributes are having problems with Oracle. And, why a
>>> Union
>>> All is being generated for a simple find operation baffles me as well.
>>> Unless there is some inheritance or eagerly fetched relationships
>>> involved.
>>> Still, I thought OpenJPA used Joins over Unions.
>>>
>>> Can you simplify the problem to a simple testcase that could be
>>> provided?
>>>
>>> Thanks,
>>> Kevin
>>>
>>> On Tue, Dec 1, 2009 at 7:15 AM, himadri <[hidden email]> wrote:
>>>
>>>
>>>>
>>>> Hi,
>>>>
>>>> I have an EJB3.0 application deployed on Weblogic 10.3 and Oracle 10g
>>>> DB. I
>>>> have an entity Typed which has Date and Boolean datatypes. em.persist
>>>> is
>>>> sucessful.
>>>>
>>>> But whereever there is em.find() on any entity in this application , I
>>>> have
>>>> observed that open JPA tries to get Union of all entities. This may
>>>> be
>>>> because its first time , But it fails with exception
>>>>
>>>> "[BEA][Oracle JDBC Driver][Oracle]ORA-01790:expression must have same
>>>> datatype as corresponding expression"
>>>>
>>>> The SQL generated is union all of all entities in the application . For
>>>> boolean FLAG_F , MOMENT_F wrong sql is generated. It should have
>>>> to_date
>>>> function for date. I have used DATE and boolean in Entity class.
>>>>
>>>> SELECT 0, t0.ID, t0.version, t0.NAME_F, '', 0, NULL, '', 0, 0,
>>>> '1970-01-01',
>>>> '', 0.0 FROM AddOn_T t0 WHERE t0.ID = ?
>>>> UNION ALL
>>>> SELECT 1, t0.ID, t0.version, '', '', t0.COUNTER_F, t0.DATA_F,
>>>> t0.ENUMED1_F,
>>>> t0.ENUMED2_F, t0.FLAG_F, t0.MOMENT_F, t0.NAME_F, t0.VALUE_F FROM
>>>> TYPED_T t0
>>>> WHERE t0.ID = ? [params=(String) 30, (String) 30]} [code=1790,
>>>> state=HY000]
>>>>
>>>> I guess openJPA fails to add to_date function for DATE and surrounding
>>>> chars
>>>> for boolean. Is this a bug or some settings available. Why is it
>>>> trying to
>>>> get union all even for em.find(... ) ?
>>>>
>>>> Thanks in advance..
>>>> - H
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> View this message in context:
>>>> http://n2.nabble.com/Open-JPA-generates-incorrect-Union-All-for-Date-and-Boolean-Datatype-tp4093559p4093559.html
>>>> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>>>>
>>>
>>>
>>> ________________________________
>>>
>>> View message @
>>> http://n2.nabble.com/Open-JPA-generates-incorrect-Union-All-for-Date-and-Boolean-Datatype-tp4093559p4103283.html
>>>
>>> To unsubscribe from Open JPA generates incorrect Union All for Date and
>>> Boolean Datatype, click here.
>>>
>>>
>>>
>>> The INTERNET now has a personality. YOURS! See your Yahoo!
>>> Homepage. http://in.yahoo.com/
>>>
>>>
>>
>>
>
>
--
View this message in context:
http://n2.nabble.com/Open-JPA-generates-incorrect-Union-All-for-Date-and-Boolean-Datatype-tp4093559p4148425.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.