[OS-JIRA] Created: (CAY-96) synchronization erroneously saves NULL

From: jir..bjectstyle.org
Date: Thu Feb 12 2004 - 11:46:43 EST

  • Next message: Mike Kienenberger: "Bug in latest cvs --No suitable DataNode to handle query with root: class [dataobject class]"

    Message:

      A new issue has been created in JIRA.

    ---------------------------------------------------------------------
    View the issue:

      http://objectstyle.org/jira/secure/ViewIssue.jspa?key=CAY-96

    Here is an overview of the issue:
    ---------------------------------------------------------------------
            Key: CAY-96
        Summary: synchronization erroneously saves NULL
           Type: Bug

         Status: Assigned
       Priority: Critical

        Project: Cayenne
     Components:
                 Cayenne Core Library
       Versions:
                 1.1 [DEV]

       Assignee: Andrus Adamchik
       Reporter: Jim Menard

        Created: Thu, 12 Feb 2004 11:45 AM
        Updated: Thu, 12 Feb 2004 11:45 AM
    Environment: Mac OS X, PostgreSQL, Cayenne 1.1a-pre2

    Description:
    I'm testing 1.1a-pre2, and I think I may have found a bug. I have in-JVM synchronization switched on ("type 2" synchronization, the default).

            Address -> AddressType -> Language

    I create an address, load an address type, and assign the type to the address. Note that I never loaded the language object explicitly. When I commit changes, (A) Cayenne attempts to re-save the address type, even though it has not changed. (B) It attempts to set the language_id to NULL when it does so.

    INFO [10:21:13,109] QueryLogger: UPDATE public.address_type SET language_id = ? WHERE id = ?
    INFO [10:21:13,111] QueryLogger: [bind: NULL, 2]
    INFO [10:21:13,122] QueryLogger: *** error.
    java.sql.SQLException: ERROR: ExecUpdate: Fail to add null value in not null attribute language_id

    Here's some code that may trigger the bug. If it doesn't, I can give you the complete code. (I'm very sorry, but I have backed out of 1.1a-pre2 and do not have time right now to re-install it and create a minimal test case.)

        Address billAddress =
            (Address)context.createAndRegisterNewObject("Address");
        // set other of address
        billAddress.setAddressType(AddressType.findNamed(AddressType.BILLING,
                                                         context));
    // AddressType.findNamed does this:
    // SelectQuery query =
    // new SelectQuery(AddressType.class,
    // ExpressionFactory.matchExp("type", name));
    //
    // List list = context.performQuery(query);
    // return list.size() > 0 ? (AddressType)list.get(0) : null;

        account.setBillingAddress(billAddress);
        member.setBillAccount(account);
        context.commitChanges();

    When committing, Cayenne tries to re-save the address type object and sets the language id to NULL.

    I will attach the Cayenne XML files.

    ---------------------------------------------------------------------
    JIRA INFORMATION:
    This message is automatically generated by JIRA.

    If you think it was sent incorrectly contact one of the administrators:
       http://objectstyle.org/jira/secure/Administrators.jspa

    If you want more information on JIRA, or have a bug to report see:
       http://www.atlassian.com/software/jira



    This archive was generated by hypermail 2.0.0 : Thu Feb 12 2004 - 11:46:45 EST