Title: Message
Hello!
It becose you set parameter "trigger" to true
http://www.castor.org/key-generator.html#SEQUENCE-key-generator
 
you may set the "trigger" parameter to "true". This will prevent the "Sequence_name".nexval from being pulled twice (first time in the insert statement (see above), then in the trigger). Also usefull in combination with the "returning" parameter set to "true" for Oracle (in this case you may not specify the sequence name).
 
So, if you set trigger to true, you must set up insert trigger for your tables and generate ID in this trigger before insert. Castor will not try generate any keys in this case.
Good luck!
-----Original Message-----
From: michael simons [mailto:[EMAIL PROTECTED]
Sent: Wednesday, July 02, 2003 4:11 PM
To: [EMAIL PROTECTED]
Subject: [castor-dev] Sequence and SAP-DB

Hello,

Does anybody know whether key generating by sequence works w/ SAP-DB?

I tried by the following in my mapping file but when running the program I always get a NotNull exception for the id field (i.e. the primary key "id" was not set)

<begin mapping.xml>
...
<key-generator name="SEQUENCE">
<param
name="sequence" value="stromboli"/>
<param
name="trigger" value="true"/>
</key-generator>
...
<class name="net.uniopt.biz.sys.Language" extends="net.uniopt.data.DataObject" identity="id" key-generator="SEQUENCE">
...
<end mapping.xml>

Regards,
michael

Reply via email to