Gianny,

I think we should consider changing the default behaviour for "SET <column> = 
CASE WHEN ? THEN ?
> ELSE <column>". DB2 doesn't like it, Oracle doesn't like it, Derby doesn't like it and Firebird apparently doesn't like it :)

I think I'd be in favor of a universal update command that updates all columns regardless if they have changed or individual update statements for only the columns that have changed.

What are your thoughts?

Matt

Gianny Damour wrote:
Hi Olivier,

I think that Firebird does not like the generated UPDATE statements. More accurately it does not like the "SET <column> = CASE WHEN ? THEN ? ELSE <column>" syntax.

This problem has been fixed in head as the UPDATE statements will only use the "SET <column> = ?" syntax. Meanwhile, do you know what the Firebird syntax is to achieve the same result than "SET <column> = CASE WHEN ? THEN ? ELSE <column>". If you give us this syntax, I think that it should be quick easy to fix this problem (basically, we can implement a DBSyntaxFactory and enable it by setting the db-syntax-factory element of the openejb-jar DD).

Thanks,
Gianny

Olivier Voutat wrote:

Lol, there is no space, it is just the Ctrl-c Ctrl-v, cause there was no space in my writing e-mail window so it did a return line.

Anyway, maybe it is a tip of which is the problem, but I tried to use my findBySituation, and it works BUT I don't get to alter the LocalCar (s) returned.

My code in my SessionBean


<snip>


00:34:32,073 WARN [GeronimoConnectionEventListener] connectionErrorOccurred called with null org.firebirdsql.jdbc.FBSQLException: GDS Exception. 335544569. Dynamic SQL Error
SQL error code = -104
Token unknown - line 1, char 39
THEN
at org.firebirdsql.jdbc.AbstractPreparedStatement.<init>(AbstractPreparedStatement.java:118) at org.firebirdsql.jdbc.FBPreparedStatement .<init>(FBPreparedStatement.java:40)


<snip>

Caused by: org.tranql.ql.QueryException: Error executing statement: UPDATE CARROS SET MARCA = CASE WHEN ? THEN ? ELSE MARCA END, MODELO = CASE WHEN ? THEN ? ELSE MODELO END, PLACA = CASE WHEN ? THEN ? ELSE PLACA END, QUILOMETRAGEM = CASE WHEN ? THEN ? ELSE QUILOMETRAGEM END, COR = CASE WHEN ? THEN ? ELSE COR END, SITUACAO = CASE WHEN ? THEN ? ELSE SITUACAO END, TIPO = CASE WHEN ? THEN ? ELSE TIPO END, DIARIA = CASE WHEN ? THEN ? ELSE DIARIA END WHERE CHASSI = ? at org.tranql.sql.jdbc.JDBCUpdateCommand.execute(JDBCUpdateCommand.java:69) at org.tranql.cache.SimpleFlushStrategy.flush(SimpleFlushStrategy.java:64) at org.tranql.cache.SimpleFlushStrategy.flush (SimpleFlushStrategy.java:49) at org.tranql.cache.cache.InTxCacheTracker.flush(InTxCacheTracker.java:41)
        at org.tranql.cache.InTxCache.flush(InTxCache.java:86)
at org.apache.geronimo.transaction.context.AbstractTransactionContext.flushState (AbstractTransactionContext.java:115) at org.apache.geronimo.transaction.context.InheritableTransactionContext.complete(InheritableTransactionContext.java:175)
        ... 24 more
Caused by: org.firebirdsql.jdbc.FBSQLExcep tion : GDS Exception. 335544569. Dynamic SQL Error
SQL error code = -104
Token unknown - line 1, char 39
THEN
at org.firebirdsql.jdbc.AbstractPreparedStatement.<init>(AbstractPreparedStatement.java:118)







Reply via email to