castor

use of key generator on MaxDB generates wrong command

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Blocker Blocker
  • Resolution: Fixed
  • Affects Version/s: 1.3
  • Fix Version/s: 1.3.1
  • Component/s: JDO
  • Labels:
    None
  • Number of attachments :
    3

Description

on issue 2710 use of sequence was introduced in castor test framework, the test 2550 fails with follow exception:

org.exolab.castor.jdo.PersistenceException: Nested error: com.sap.dbtech.jdbc.exceptions.DatabaseException: [-3014] (at 14): Invalid end of SQL statement: [-3014] (at 14): Invalid end of SQL statement
at org.exolab.castor.jdo.engine.SQLStatementCreate.executeStatementDuringInsert(SQLStatementCreate.java:484)

it is because castor generates the follow Oracle statement for MaxDB:

CALL INSERT INTO "TEST2550_ENTITY" ("ID","NAME") VALUES ("TEST2550_ENTITY_SEQ".nextval,?) RETURNING "ID" INTO ?

this because MaxDB engine extends Oracle engine.

i post a question on SAP SDN forum to help us to solve this problem:

https://forums.sdn.sap.com/thread.jspa?threadID=1345499&tstart=0

to know how to solve this issue we must wait that answer

  1. patch-C2724-20090518.txt
    18/May/09 3:49 PM
    1 kB
    Ralf Joachim
  2. patch-C2724-20090812.txt
    12/Aug/09 4:46 PM
    5 kB
    AHMAD HASSAN
  3. patch-C2724-20090815.txt
    15/Aug/09 5:00 AM
    4 kB
    Ralf Joachim

Activity

Hide
Ralf Joachim added a comment -

Patch that handles part of the problem.

Show
Ralf Joachim added a comment - Patch that handles part of the problem.
Hide
AHMAD HASSAN added a comment -

The solution to the problem is to use SequenceBeforeKeyGenerator instead of SequenceDuringKeyGenerator. The attached patch contains these modifications. Now the quries are issued as:

1. SELECT sequence.NEXTVAL FROM DUAL;
2. INSERT INTO table (id, col) VALUES (?, ?);

I have not tested the patch against MAXDB but I am confident that it will work fine.

Best Regards, Ahmad

Show
AHMAD HASSAN added a comment - The solution to the problem is to use SequenceBeforeKeyGenerator instead of SequenceDuringKeyGenerator. The attached patch contains these modifications. Now the quries are issued as: 1. SELECT sequence.NEXTVAL FROM DUAL; 2. INSERT INTO table (id, col) VALUES (?, ?); I have not tested the patch against MAXDB but I am confident that it will work fine. Best Regards, Ahmad
Hide
Ralf Joachim added a comment -

Exclude changes to SequenceKeyGeneratorFactory as SapDB does not support returning.

Show
Ralf Joachim added a comment - Exclude changes to SequenceKeyGeneratorFactory as SapDB does not support returning.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: