I am trying to relate two objects in a many-to-many, I used EOModeler which seemed to do everything like it is in my other projects which have successful many-to-many's. EOModeler created a join table with the two primary keys of the objects to be related and the relationships to the other tables.

I turned on SQL logging, etc.

<WorkerThread4> evaluateExpression: <com.webobjects.jdbcadaptor.FrontbasePlugIn$FrontbaseExpression: "SELECT t0."AREA_ID", t0."DISABLE_BIO", t0."EMAILS_SENT", t0."EVENT_DATE", t0."EVENT_DESCRIPTION", t0."EVENT_ID", t0."FRIENDS_ID", t0."HIDE_TIME", t0."HOUR", t0."LOCATION", t0."LONG_DESCR", t0."LONGER_DESCR", t0."MINUTE", t0."RECURRING", t0."REGION_ID", t0."SEND_EMAIL", t0."SEND_NOW", t0."STATE_ID", t0."TIME_ZONE", t0."TIMER_ID", t0."URL", t0."VISIBILITY_LEVEL" FROM "IN_EVENT" t0, "FRIENDS_IN_EVENT" T1, "FRIENDS" T2 WHERE T2."FRIENDS_ID" = 1000001 AND t0."EVENT_ID" = T1."EVENT_ID" AND T1."FRIENDS_ID" = T2."FRIENDS_ID"">
 <WorkerThread4> 0 row(s) processed
 <WorkerThread4>  === Commit Internal Transaction
 <WorkerThread4>  === Begin Internal Transaction
 <WorkerThread4>  === Rollback Internal Transaction
<WorkerThread4> <com.webobjects.appserver._private.WOComponentRequestHandler>: Exception occurred while handling request: com.webobjects.foundation.NSForwardException [com.webobjects.eoaccess.EOGeneralAdaptorException] null: An exception was thrown when trying to delete a transaction. <WorkerThread4> com.webobjects.foundation.NSForwardException for com.webobjects.eoaccess.EOGeneralAdaptorException at com.webobjects.eoaccess.EODatabaseContext._exceptionWithDatabaseContextI nformationAdded(EODatabaseContext.java:4685) at com.webobjects.eoaccess.EODatabaseContext.performChanges (EODatabaseContext.java:6393)

My code looks like:
    public WOComponent registerChanges()  {
java.util.Enumeration enumerator = allFriends.displayedObjects ().objectEnumerator();
                while ( enumerator.hasMoreElements() )  {
                        Friends nextFriend = (Friends)enumerator.nextElement();
if ( nextFriend.inAttendance && ! nextFriend.editAttendance ) { // remove attendee
                                ...
} else if ( nextFriend.editAttendance && ! nextFriend.inAttendance ) { // new attendee nextFriend.addObjectToBothSidesOfRelationshipWithKey ( registerForEvent, "InEvents" ); registerForEvent.addObjectToBothSidesOfRelationshipWithKey ( nextFriend, "friendss" );
                                nextFriend.inAttendance = true;
                        }
                }
                try  {
                        _Utilities.eoSaveChanges( session );            // 
throws exception

I have 2 public booleans in the Friends EOGenericRecord sub-class which are used for the WOCheckBoxes in the WORepetition. All the displaying and clicking seems to work fine and the one friend in the list who attends the event is picked up by the loop.

Why is it saying in the log "An exception was thrown when trying to delete a transaction."
<deleteObject> is not being called.

It should create a join record in the join table and alter the in- memory arrays of the Friends EO and the InEvents EO.

----
Baiss Eric Magnusson
<http://www.Track-Your-Finances.com>
<http://www.CascadeWebDesign.com>


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to