Have you created a Sequence named WFS_SEQ_TYPE_OBS in the database beforehand...you will need to.
See http://e-docs.bea.com/wls/docs61/ejb/cmp.html
look under the heading 'Specifying Primary Key Support for Oracle'
regards
Duncan
Duncan Alexander
Consultant
Email: [EMAIL PROTECTED]
Spektra
Integration House
Alba Campus
Livingston, EH54 7LL, Scotland
Tel: +44 (0) 1506 460234 Fax: +44 (0) 1506 460212
W: http://www.spektra.co.uk
'driving e-finance - delivering solutions to the financial services industry'
This email is intended for the person or organisation to which it is addressed.
The information contained in this email is confidential and may be subject to
legal privilege. If the reader is not the intended recipient, you are hereby
notified that any dissemination, distribution, or copying of this communication
is prohibited. If you receive this email in error please notify Spektra Systems
immediately by telephone on +44 (0) 1506 460234. Thank you.
| PEARCE TOMENIUS Zina <[EMAIL PROTECTED]>
Sent by: A mailing list for Enterprise JavaBeans development <[EMAIL PROTECTED]> 25/09/2002 09:07
|
To: [EMAIL PROTECTED] cc: Subject: [EJB-INT] EJB CMP 2.0 Automatic Primary Key Generation |
Hi,
I am using Weblogic 6.1 (sp2), with an Oracle database and JBuilder 7 to
develop some CMP 2.0 Entity Beans. I would like the primary (single,
non-composite) keys (integer sequences) of ejbCreate calls to be
automatically generated.
As I understand it, I can add the following to the weblogic cmp XML file:
<automatic-key-generation>
<generator-type>ORACLE</generator-type>
<generator-name>WFS_SEQ_TYPE_OBS</generator-name>
<key-cache-size>1</key-cache-size>
</automatic-key-generation>
The trouble is that I get a 'ORA-01400' error ("can't insert a null in PK
column") , when I try to create a new record. Should I have done something
else as well as add the XML to the Weblogic descriptor (e.g. change the
ejbCreate methods)? Or maybe I shouldn't be using JBuilder to create the
stubs etc / deploy the bean (use Weblogic ejbc instead)?
Otherwise, I could just write JDBC within the same transaction to pass the
next available unique key to the entity bean. But is this a 'standard' way
to do things?
Thanks very much.
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".
