Hi,

I have a bridging table (for a M-N relation).  The table consist of two
integer id's.

To join two tables I create a new object for this table and after adding the
respective id's I call the save() method.

The problem is that the generated code in the buildCriteria method looks
like this:

        Criteria criteria = new Criteria();
        if ( !obj.isNew() )
            criteria.add( ERESOURCE_ID, obj.getEresourceId() );
        if ( !obj.isNew() )
            criteria.add( RESOURCE_FIELD_ID, obj.getResourceFieldId() );
        criteria.add( AVALUE, obj.getAvalue() );
        return criteria;

Therefore none of the new id's is added to the criteria object and I get a
database exception.

If I remove the primary key - the table now has no primary key and only two
integer values.  I get:

 Exception:  java.lang.NullPointerException
 Stack Trace follows:
 java.lang.NullPointerException
 at org.apache.turbine.om.peer.BasePeer.doInsert(BasePeer.java:718)
 at org.apache.turbine.om.peer.BasePeer.doInsert(BasePeer.java:614)
 at
za.co.opticode.infoportal.db.peer.FieldValuePeer.doInsert(FieldValuePeer.jav
a:46)
 at
za.co.opticode.infoportal.db.peer.FieldValuePeer.doInsert(FieldValuePeer.jav
a:186)
 at
za.co.opticode.infoportal.om.peer.EresourcePeer.setEresourceFields(Eresource
Peer.java:156)

It seems that if a table has no Primary keys that the BasePeer code stops
working.  Any ideas how I can get my bridging table to work?

~ Leon



------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?:           [EMAIL PROTECTED]

Reply via email to