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 <[email protected]> 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. >
