This one time, at band camp, Jakob Praher said:
JP>I would like do a N:M mapping not for custom objects, but for
JP>java.lang.Integer elements like:
JP>
JP>[ this does not work for me, [ClassMolder.<init> NullPointerException ]
JP>]
JP>
JP> <field name="myField"
JP> type="java.lang.Integer"
JP> ^^^^^^^^^^^^^^^^^
JP> lazy="false"
JP> get-method="getMyField"
JP> set-method="setMyField"
JP> collection="collection">
JP> <sql name="my_field"
JP> many-key="id"
JP> many-table="objects_contains_fields" />
JP> </field>
JP>
JP>class A {
JP> public Collection getMyField( ) {
JP> ...
JP> }
JP> public void setMyField( Collection value ) {
JP> ...
JP> }
JP>
JP>}
JP>
JP>// use case
JP>A a = (A )db.load( A.class, 2 );
JP>for ( Iterator it = a.getMyField( ).iterator( ); it.hasNext( ); )
JP>{
JP> Integer el = (Integer ) it.next( );
JP>}
JP>
JP>but somehow I always get a NullPointer exception in ClassMolder.<init> @
JP>358.
JP>
JP>is this somehow possible?
JP>or must all many-to-many relations be wrapped in a custom class, which
JP>means, I would have to introduce a separate class and table.
Jakob,
Castor JDO cannot handle a Collection of primitive wrapper objects. In
your case, the reason for this is that java.lang.Integer does not have
a mapping describing it to Castor JDO. The same is true for any of the
primitives and/or primitive wrapper objects.
Bruce
--
perl -e 'print unpack("u30","<0G)[EMAIL PROTECTED]&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