This one time, at band camp, Ben Bertola said:
BB>I tried declaring the return param element as suggested below, but still
BB>get the same error. Are there other parameters I need to set?
BB>
BB>
BB>
BB>>>> [EMAIL PROTECTED] 02/23/04 04:32PM >>>
BB>
BB>This one time, at band camp, Ben Bertola said:
BB>
BB>BB>I am getting the following error when I create an object:
BB>BB>
BB>BB>WARNING: CORE3283: stderr:
BB>org.exolab.castor.jdo.PersistenceException:
BB>BB>Cannot create object of type org.usiis.struts.CommentForm with null
BB>BB>identity field and no key generator
BB>BB>WARNING: CORE3283: stderr: at
BB>BB>org.exolab.castor.jdo.engine.SQLEngine.create
BB>BB>.....
BB>BB>
BB>BB>I have defined an identity field for this object, as well as a
BB>sequence
BB>BB>generator:
BB>BB>
BB>BB> <key-generator name="PAT_COMMENTS_SEQ" alias="PAT_COMMENTS_SEQ">
BB>BB> <param name="sequence" value="www_patient_comments_seq"/>
BB>BB> </key-generator>
BB>BB>
BB>BB><class name="org.usiis.struts.CommentForm" identity="patCommentId"
BB>BB>key-generator="PAT_COMMENTS_SEQ">
BB>BB> <map-to table="WWW_PATIENT_COMMENTS"/>
BB>BB> <field name="patCommentId" type="integer"><sql
BB>BB>name="pat_comment_id" type="integer"/></field>
BB>BB> .....
BB>BB></class>
BB>BB>
BB>BB>Any ideas as to what I'm doing wrong?
BB>
BB>Ben,
BB>
BB>You forgot to declare the returning <param> element in the
BB><key-generator> element like so:
BB>
BB> <key-generator name="PAT_COMMENTS_SEQ" alias="PAT_COMMENTS_SEQ">
BB> <param name="sequence" value="www_patient_comments_seq"/>
BB> <param name="returning" value="true"/>
BB> </key-generator>
BB>
BB>This tells Castor that the id must be returned from the sequence
BB>to the Java code.
No, the above <key-generator> element is all that is needed by
Castor to effectively use the sequence. I use this all the time
with Oracle and I have no problem whatsoever. In fact, in the JDO
test cases (located in src/tests/jdo from a source download or from
CVS) use the same <key-generator> element for testing a sequence
key generator.
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