• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Can't modify EO objects! ARGH! =(
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can't modify EO objects! ARGH! =(


  • Subject: Re: Can't modify EO objects! ARGH! =(
  • From: Goodbye Bill <email@hidden>
  • Date: Thu, 17 Jul 2003 18:59:13 -0400

Chuck,

I AM tossing the SQL to debug.  That's the odd part!  The SQL should match
up perfectly to a single record.  Remember, the object that it is basing the
update/delete on is an unmodified version of what was loaded to begin with.

Here is the SQL...

    UPDATE tblSignupRequests
    SET isAvailable = ?
    WHERE
    (
        requestId = ? AND
        emailAddress = ? AND
        nickname = ? AND
        dateCreated = ? AND
        nameFirst = ? AND
        nameLast = ? AND
        confCode = ? AND
        isAvailable = ?
    )"
    withBindings:
        1:0(isAvailable),
        2:"FD19A648-D7D1-23E7-58BD-1E8892630E82"(requestId),
        3:"email@hidden"(emailAddress),
        4:"jblow"(reqNickname),
        5:2003-07-17 05:54:03(dateCreated),
        6:"Joe"(nameFirst),
        7:"Blow"(nameLast),
        8:"DUGLOP"(confCode),
        9:1(isAvailable)

Here is the data...

        _rowid:         25
        isAvailable:    1
        confCode:       DUGLOP
        dateCreated:    2003-07-17 05:54:03 -0400
        emailAddress:   email@hidden
        nameFirst:      Joe
        nameLast:       Blow
        reqNickname:    jblow
        requestId:      FD19A648-D7D1-23E7-58BD-1E8892630E82

This is directly from debug and the OpenBase Data Browser.

See anything?






On 20030717 1623, "Chuck Hill" <email@hidden> wrote:

> I'm not too sure what might be causing this, there is a lot in your
> session is not here.
>
> What is happening is that an Update x SET a = b WHERE y=z; is failing
> as nothing matches y=z.  The first thing to do is to look at the SQL,
> and then at your data to see what is not matching.  Then work backward
> from there.
>
> To see the SQL being sent by the app:
>
> public static void logSQL(boolean shouldLog) {
>    if (shouldLog) {
>        NSLog.allowDebugLoggingForGroups(NSLog.DebugGroupSQLGeneration
>        | NSLog.DebugGroupDatabaseAccess
>        | NSLog.DebugGroupEnterpriseObjects);
>    } else {
>      NSLog.refuseDebugLoggingForGroups(NSLog.DebugGroupSQLGeneration
>        | NSLog.DebugGroupDatabaseAccess
>        | NSLog.DebugGroupEnterpriseObjects);
>    }
> }
>
>
> Chuck
>
> P.S. You are probably putting more logic in Session that is optimal.
> Much of that would be more comfortable in another class, perhaps even
> the page.
>
> P.P.S. Hungarian naming is ugly and unnecessary in Java.
>
>
>
> Goodbye Bill wrote:
>> Chuck,
>>
>> Thank you for the feedback.  I have changed that line of code, but I am
>> still having the same problem.  Again, the "Member" object (the new object)
>> saves fine.  It's the "Signup Request" object (the one I loaded from the
>> database) that fails for any type of update or delete.
>>
>> Here are the two methods that load and save the objects:
>>
>> public class Session extends WOSession {
>>
>>     public EOEditingContext oContext = this.defaultEditingContext();
>>     protected SignupRequest my_oCurrentSignupRequest;
>>     protected Member my_oNewSignupMember;
>>
>>     public void CreateEmptySignupMember() {
>>         setNewSignupMember(null);
>>         setNewSignupMember(new Member());
>>         oContext.insertObject(my_oNewSignupMember);
>>     }
>>
>>     public void SaveNewMember() {
>>         if ( isNewSignupMemberCreated() == false ) { return; }
>>         try  {
>>             my_oCurrentSignupRequest.setIsAvailable(new Integer(0));
>>             oContext.saveChanges();
>>             isSignupStepCComlete(Boolean.TRUE);
>>         }
>>         catch ( Exception oErr ) {
>>             oErr.printStackTrace();
>>             setSignupError("An unexpected database error occurred while
>>             trying to create your database.  Please try again later.");
>>         }
>>     }
>> }
>>
>> The only error I receive is:
>>
>>     [2003-07-17 15:49:25 EDT] <WorkerThread3>  === Rollback Internal
>>         Transaction
>>     com.webobjects.eoaccess.EOGeneralAdaptorException:
>>         updateValuesInRowDescribedByQualifier --
>>         com.webobjects.jdbcadaptor.JDBCChannel method failed to update
>>         row in database
>>
>> Any ideas?
>>
>>
>>
>>
>>
>> On 20030717 1336, "Chuck Hill" <email@hidden> wrote:
>>
>>
>>> Goodbye Bill wrote:
>>>
>>>> default EC.  I then create a new "Member" object without
>>>> inserting it into the EC.  I populate the variables of
>>>> the "Member" object, stick it into the EC
>>>>
>>>
>>> Klaxons and red flashing lights go on.
>>>
>>> Don't do that!  The pattern is:
>>>
>>> 1. Create
>>> 2. Insert
>>> 3. Populate
>>> 4. Save
>>>
>>> See:
>>> http://wodev.spearway.com/cgi-bin/WebObjects/WODev.woa/wa/Main?wikiPage=EOFC
>>> om
>>> mandments
>>>
>>>
>>> Chuck
>>>
>>>
>>> Goodbye Bill wrote:
>>>
>>>> Could someone please tell me why I cannot destroy an object in the database
>>>> once it is loaded into the session?
>>>>
>>>> DETAILS:
>>>> I have a two-step signup process for my web site.  Users must create a
>>>> "Signup Request" including their name and email address.  A confirmation
>>>> code is then sent their email address.  They must return to the site and
>>>> enter this confirmation code before their "Member" object will get created.
>>>>
>>>> ISSUE:
>>>> When the user returns to the site to enter their confirmation code, I load
>>>> the "Signup Request" object into a local object within the session using
>>>> the
>>>> default EC.  I then create a new "Member" object without inserting it into
>>>> the EC.  I populate the variables of the "Member" object, stick it into the
>>>> EC, then attempt to save the "Member" object while blowing away the "Signup
>>>> Request" object.  I have tried this as two separate commands and together
>>>> as
>>>> one.  The "Member" object always saves fine however I cannot do anything
>>>> with the "Signup Request" object.
>>>>
>>>> ERROR DETAILS FOLLOW:
>>>> com.webobjects.eoaccess.EOGeneralAdaptorException:
>>>> updateValuesInRowDescribedByQualifier --
>>>> com.webobjects.jdbcadaptor.JDBCChannel method failed to update row in
>>>> database
>>>>    at
>>>>
com.webobjects.eoaccess.EODatabaseContext._exceptionWithDatabaseContextInfo>>>>
r
>>>> mationAdded(EODatabaseContext.java:4658)
>>>>    at
>>>>
com.webobjects.eoaccess.EODatabaseContext.performChanges(EODatabaseContext.>>>>
j
>>>> ava:6365)
>>>>    at
>>>>
com.webobjects.eocontrol.EOObjectStoreCoordinator.saveChangesInEditingConte>>>>
x
>>>> t(EOObjectStoreCoordinator.java:411)
>>>>    at
>>>>
com.webobjects.eocontrol.EOEditingContext.saveChanges(EOEditingContext.java>>>>
:
>>>> 3128)
>>>>    at Session.SaveNewMember(Session.java:85)
>>>> _______________________________________________
>>>> webobjects-dev mailing list | email@hidden
>>>> Help/Unsubscribe/Archives:
>>>> http://www.lists.apple.com/mailman/listinfo/webobjects-dev
>>>> Do not post admin requests to the list. They will be ignored.
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Can't modify EO objects! ARGH! =(
      • From: Art Isbell <email@hidden>
    • Re: Can't modify EO objects! ARGH! =(
      • From: Chuck Hill <email@hidden>
References: 
 >Re: Can't modify EO objects! ARGH! =( (From: Chuck Hill <email@hidden>)

  • Prev by Date: Re: Can't modify EO objects! ARGH! =(
  • Next by Date: Re: Can't modify EO objects! ARGH! =(
  • Previous by thread: Re: Can't modify EO objects! ARGH! =(
  • Next by thread: Re: Can't modify EO objects! ARGH! =(
  • Index(es):
    • Date
    • Thread