This one time, at band camp, Ben Bertola said:
BB>I am getting the following error when I create an object:
BB>
BB>WARNING: CORE3283: stderr: org.exolab.castor.jdo.PersistenceException:
BB>Cannot create object of type org.usiis.struts.CommentForm with null
BB>identity field and no key generator
BB>WARNING: CORE3283: stderr: at
BB>org.exolab.castor.jdo.engine.SQLEngine.create
BB>.....
BB>
BB>I have defined an identity field for this object, as well as a sequence
BB>generator:
BB>
BB> <key-generator name="PAT_COMMENTS_SEQ" alias="PAT_COMMENTS_SEQ">
BB> <param name="sequence" value="www_patient_comments_seq"/>
BB> </key-generator>
BB>
BB><class name="org.usiis.struts.CommentForm" identity="patCommentId"
BB>key-generator="PAT_COMMENTS_SEQ">
BB> <map-to table="WWW_PATIENT_COMMENTS"/>
BB> <field name="patCommentId" type="integer"><sql
BB>name="pat_comment_id" type="integer"/></field>
BB> .....
BB></class>
BB>
BB>Any ideas as to what I'm doing wrong?
Ben,
You forgot to declare the returning <param> element in the
<key-generator> element like so:
<key-generator name="PAT_COMMENTS_SEQ" alias="PAT_COMMENTS_SEQ">
<param name="sequence" value="www_patient_comments_seq"/>
<param name="returning" value="true"/>
</key-generator>
This tells Castor that the id must be returned from the sequence
to the Java code.
Bruce
--
perl -e 'print unpack("u30","<0G)[EMAIL PROTECTED]&5R\"F9E<G)E=\$\!F<FEI+F-O;0\`\`");'
The Castor Project
http://www.castor.org/
Apache Geronimo
http://incubator.apache.org/projects/geronimo.html
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev