geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Hogstrom <m...@hogstrom.org>
Subject Re: Problem with CMP-update code and Oracle
Date Tue, 22 Nov 2005 16:45:46 GMT
This is a problem in the code that is generated.  TranQL uses SQL-92 format by 
default and that is not workable for DB2 or Oracle (granted, we probably used 
the wrong default.  You need to add a syntax factory to the deployment plan to 
generate the correct code.  Have you tried the Oracle or DB2 syntax factories? 
Etierh one should work.  I would try the Oracle one first, if that is a problem 
try DB2.  Please post back your results so we can fix it.

The problem is that the SQL92 specification was poorly written and the CASE WHEN 
  statements could use either a syntax in the form of CASE WHEN ? (assuming a 
boolean) or CASE WHEN 1 = ? where one would require an lvalue in this case a 1 
to complete the boolean comparison.  Apparently both DB2 and Oracle assume that 
one will provide a complete syntax.  I believe the DB2 driver has this as well 
as the Oracle one.

Here is the syntax as snipped from the DayTrader deployment plan.

             <!--
             ##
             ##  C o n n e c t i o n  F a c t o r y  D e f i n i t i o n
             ##
             ##
             ##
             -->
             <cmp-connection-factory>
                 <resource-link>jdbc/TradeDataSource</resource-link>
             </cmp-connection-factory>

<!--  For DB2 database users uncomment the following line.
 
<ejb-ql-compiler-factory>org.tranql.ejbcompiler.DB2EJBQLCompilerFactory</ejb-ql-compiler-factory>
 
<db-syntax-factory>org.tranql.sql.db2.DB2DBSyntaxFactory</db-syntax-factory>
-->

<!--  For Oracle database users uncomment the following line.
 
<ejb-ql-compiler-factory>org.tranql.ejbcompiler.OracleQLCompilerFactory</ejb-ql-compiler-factory>
 
<db-syntax-factory>org.tranql.sql.oracle.OracleDBSyntaxFactory</db-syntax-factory>
-->


Neil Gray wrote:
> When I tried setting up a connection to Oracle 10g (10.1.0.x) for an 
> entity bean I got
> SQL errors from the update statements that were generated for the beans.
> The SQL code generated is of the form:
> update mytable set balance = case when ?  then ? else balance end where 
> customername = ?
> 
> Oracle complains of an invalid relational operator; it doesn't seem to 
> like "when ? then" where the "?" parameter just gets assigned a 
> true/false value.
> 
> Is there any extra parameter that modifies the generated CMP code by 
> database type?
> 
> _________________________________________________________________
> Start something musical - 15 free ninemsn Music downloads! 
> http://ninemsn.com.au/share/redir/adTrack.asp?mode=click&clientID=667&referral=HotmailTaglineNov&URL=http://www.ninemsn.com.au/startsomething

> 
> 
> 
> 
> 


Mime
View raw message