The CASE syntax is a poor choice and we will address it. For DB2 and Oracle there are alternate
syntax factories that are available. Here is a sample 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>
<ejb-ql-compiler-factory>com.tranql.sql.ejbcompiler.OracleEJBQLCompilerFactory</ejb-ql-compiler-factory>
<db-syntax-factory>com.tranql.sql.oracle.OracleDBSyntaxFactory</db-syntax-factory>
This will generate code that is not using the CASE Statement
Santosh Koti wrote:
Hi Folks,
I am facing a problem in running ejb based transaction.
Here is stack trace for my exception (in parts):
javax.ejb.TransactionRolledbackLocalException
at
org.openejb.transaction.ContainerPolicy$TxRequired.invoke(ContainerPolic
y.java:123)
at
org.openejb.transaction.TransactionContextInterceptor.invoke(Transaction
ContextInterceptor.java:80)
at
org.openejb.SystemExceptionInterceptor.invoke(SystemExceptionInterceptor
.java:82)
at
org.openejb.GenericEJBContainer.invoke(GenericEJBContainer.java:238)
.......
.......
Caused by: javax.ejb.EJBException: Error executing statement: UPDATE
AccountDetails SET bankID = CASE WHEN ? THEN ? ELSE bank
at
com.infosys.j2ee.setlbank.appservice.accounts.impl.AccountsInfoEJB.credi
t(AccountsInfoEJB.java:322)
.......
.......
Caused by: javax.ejb.FinderException: Error executing statement: UPDATE
AccountDetails SET bankID = CASE WHEN ? THEN
at
org.openejb.entity.cmp.SingleValuedFinder.execute(SingleValuedFinder.jav
a:83)
at
org.openejb.dispatch.DispatchInterceptor.invoke(DispatchInterceptor.java
:72)
at
org.apache.geronimo.naming.java.ComponentContextInterceptor.invoke(Compo
nentContextInterceptor.java:56)
.......
.......
Caused by: org.tranql.ql.QueryException: Error executing statement:
UPDATE AccountDetails SET bankID = CASE WHEN ? THEN ? ELSE
at
org.tranql.sql.jdbc.JDBCUpdateCommand.execute(JDBCUpdateCommand.java:69)
at
org.tranql.cache.SimpleFlushStrategy.flush(SimpleFlushStrategy.java:64)
Caused by: java.sql.SQLException: ORA-00920: invalid relational operator
.......
.......
at
oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:582)
I think the key word : 'CASE' is giving problem, because it is not been
recognized by Oracle during the execution of the query.
But any ways to remove that , or can any1 suggest some workarounds
which will be of great help...!!
I tried many options , but no luck :-(
Thanks,
Santosh.
"Don't talk about yourself; it will be done when you leave. "
**************** CAUTION - Disclaimer *****************
This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely
for the use of the addressee(s). If you are not the intended recipient, please
notify the sender by e-mail and delete the original message. Further, you are
not to copy, disclose, or distribute this e-mail or its contents to any other
person and any such actions are unlawful. This e-mail may contain viruses.
Infosys has taken every reasonable precaution to minimize this risk, but is not
liable for any damage you may sustain as a result of any virus in this e-mail.
You should carry out your own virus checks before opening the e-mail or
attachment. Infosys reserves the right to monitor and review the content of all
messages sent to or from this e-mail address. Messages sent to or from this
e-mail address may be stored on the Infosys e-mail system.
***INFOSYS******** End of Disclaimer ********INFOSYS***