This one time, at band camp, Keith Chew SL said:
KCS >OK, here's the catch. If you create a key generator (I used HIGH/LOW) and
KCS >make ProductGroup use it, Castor cannot create the Product object. The
KCS >group_id will be left as null and the DB will complain with: "ERROR:
KCS >ExecAppend: Fail to add null value in not null attribute group_id" (This is
KCS >from postgresql).
KCS >
KCS >To reproduce this problem just add this to the mapping.xml and create the
KCS >keys table:
KCS >
KCS > <key-generator name="HIGH/LOW">
KCS > <param name="table" value="keys"/>
KCS > <param name="key-column" value="table_name"/>
KCS > <param name="value-column" value="max_pk_value"/>
KCS > <param name="grab-size" value="1000"/>
KCS > </key-generator>
KCS >
KCS > <!-- Mapping for ProductGroup -->
KCS > <class name="myapp.ProductGroup"
KCS > identity="id" access="shared" key-generator="HIGH/LOW">
KCS > <description>Product group</description>
KCS > <map-to table="prod_group" xml="group" />
KCS > <cache-type type="unlimited"/>
KCS > <field name="id" type="integer" >
KCS > <sql name="id" type="integer"/>
KCS > <xml node="element"/>
KCS > </field>
KCS > <field name="name" type="string">
KCS > <sql name="name" type="char" />
KCS > <xml node="element" />
KCS > </field>
KCS > </class>
KCS >
Keith,
I neglected to take notice that ProductGroup is using a key generator. Even
though I see this now, I wouldn't have picked out that this was the probloem
before. Nice work tracking that down. Also, thanks for the clarification.
--
perl -e 'print unpack("u30","<0G)U8V4\@4VYY9&5R\"F9E<G)E=\$\!F<FEI+F-O;0\`\`");'
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev