FAQ
Kevin,

I can apply the patch attached by Robert. Any objections? (honestly I
haven't spent much time lately looking into XML serialization, so I
will only run our existing test suite to ensure it passes)

Andrus


Begin forwarded message:
From: "Robert Zeigler (JIRA)" <dev@cayenne.apache.org>
Date: April 19, 2007 3:28:44 PM GMT+03:00
To: andrus@objectstyle.org
Subject: [JIRA] Commented: (CAY-763) XML Deserialization fails on
relationships when using a mapping file


[ https://issues.apache.org/cayenne/browse/CAY-763?
page=com.atlassian.jira.plugin.system.issuetabpanels:comment-
tabpanel#action_12292 ]

Robert Zeigler commented on CAY-763:
------------------------------------

Any progress on this front?

XML Deserialization fails on relationships when using a mapping file
--------------------------------------------------------------------

Key: CAY-763
URL: https://issues.apache.org/cayenne/browse/CAY-763
Project: Cayenne
Issue Type: Bug
Components: Cayenne Core Library
Affects Versions: 1.2 [STABLE], 2.0 [STABLE]
Environment: Any
Reporter: Robert Zeigler
Assigned To: Andrus Adamchik
Attachments: cay-763.patch


When XMLDecoder deserializes objects using a mapping descriptor,
no objects are registered with a datacontext until after all
objects have been initialized. However, cayenne requires a non-
null datacontext to correctly handle relationships. Hence,
dataobjects using the default cayenne handling of relationships
(either to-one or to-many) will be unable to deserialize objects
from XML (due to null pointers).
In the case of a collection, the getXXX method will return null,
and the XMLMappingDescriptor fails to "sense" a collection.
In the case of a to-one relationship, a NPE exception is thrown
trying to set the child property of the parent object.
The simplest way to fix this would be to make XMLMappingDescriptor
DataContext-capable (ie: will register objects with a datacontext,
if one is provided, as the objects are created). I've done this in
a local copy of the code. I will attach a patch when I get a minute.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Search Discussions

  • Kevin Menard at Apr 19, 2007 at 7:31 pm
    There are two things that come up.

    1) Per my comment, I think we deliberately removed the ability to
    auto-register with a DC. Perhaps that was a bad decision, perhaps not.
    Now that I've been prodded a bit, I'll try to dig up the proper thread.

    2) If we do decide that auto-registration may be a bad idea, then the
    problem is a result of trying to associate two unregistered DOs. This
    is something that needs to be addressed at a higher level and is slated
    for 3.0.x. It would be a big change to throw into a "stable" release.

    --
    Kevin
    -----Original Message-----
    From: Andrus Adamchik
    Sent: Thursday, April 19, 2007 8:49 AM
    To: dev@cayenne.apache.org
    Subject: Fwd: [JIRA] Commented: (CAY-763) XML Deserialization
    fails on relationships when using a mapping file

    Kevin,

    I can apply the patch attached by Robert. Any objections?
    (honestly I haven't spent much time lately looking into XML
    serialization, so I will only run our existing test suite to
    ensure it passes)

    Andrus


    Begin forwarded message:
    From: "Robert Zeigler (JIRA)" <dev@cayenne.apache.org>
    Date: April 19, 2007 3:28:44 PM GMT+03:00
    To: andrus@objectstyle.org
    Subject: [JIRA] Commented: (CAY-763) XML Deserialization fails on
    relationships when using a mapping file


    [ https://issues.apache.org/cayenne/browse/CAY-763?
    page=com.atlassian.jira.plugin.system.issuetabpanels:comment-
    tabpanel#action_12292 ]

    Robert Zeigler commented on CAY-763:
    ------------------------------------

    Any progress on this front?

    XML Deserialization fails on relationships when using a
    mapping file
    --------------------------------------------------------------------
    Key: CAY-763
    URL:
    https://issues.apache.org/cayenne/browse/CAY-763
    Project: Cayenne
    Issue Type: Bug
    Components: Cayenne Core Library
    Affects Versions: 1.2 [STABLE], 2.0 [STABLE]
    Environment: Any
    Reporter: Robert Zeigler
    Assigned To: Andrus Adamchik
    Attachments: cay-763.patch


    When XMLDecoder deserializes objects using a mapping
    descriptor, no
    objects are registered with a datacontext until after all objects
    have been initialized. However, cayenne requires a non- null
    datacontext to correctly handle relationships. Hence, dataobjects
    using the default cayenne handling of relationships
    (either to-one or
    to-many) will be unable to deserialize objects from XML
    (due to null
    pointers).
    In the case of a collection, the getXXX method will return
    null, and
    the XMLMappingDescriptor fails to "sense" a collection.
    In the case of a to-one relationship, a NPE exception is thrown
    trying to set the child property of the parent object.
    The simplest way to fix this would be to make XMLMappingDescriptor
    DataContext-capable (ie: will register objects with a
    datacontext, if
    one is provided, as the objects are created). I've done this in a
    local copy of the code. I will attach a patch when I get a minute.
    --
    This message is automatically generated by JIRA.
    -
    You can reply to this email to add a comment to the issue online.
  • Andrus Adamchik at Apr 20, 2007 at 1:53 pm
    Thanks for clarification. Now that I am looking closer at the patch,
    I think it is not that simple either.

    Andrus
    On Apr 19, 2007, at 10:30 PM, Kevin Menard wrote:
    There are two things that come up.

    1) Per my comment, I think we deliberately removed the ability to
    auto-register with a DC. Perhaps that was a bad decision, perhaps
    not.
    Now that I've been prodded a bit, I'll try to dig up the proper
    thread.

    2) If we do decide that auto-registration may be a bad idea, then the
    problem is a result of trying to associate two unregistered DOs. This
    is something that needs to be addressed at a higher level and is
    slated
    for 3.0.x. It would be a big change to throw into a "stable" release.

    --
    Kevin
    -----Original Message-----
    From: Andrus Adamchik
    Sent: Thursday, April 19, 2007 8:49 AM
    To: dev@cayenne.apache.org
    Subject: Fwd: [JIRA] Commented: (CAY-763) XML Deserialization
    fails on relationships when using a mapping file

    Kevin,

    I can apply the patch attached by Robert. Any objections?
    (honestly I haven't spent much time lately looking into XML
    serialization, so I will only run our existing test suite to
    ensure it passes)

    Andrus


    Begin forwarded message:
    From: "Robert Zeigler (JIRA)" <dev@cayenne.apache.org>
    Date: April 19, 2007 3:28:44 PM GMT+03:00
    To: andrus@objectstyle.org
    Subject: [JIRA] Commented: (CAY-763) XML Deserialization fails on
    relationships when using a mapping file


    [ https://issues.apache.org/cayenne/browse/CAY-763?
    page=com.atlassian.jira.plugin.system.issuetabpanels:comment-
    tabpanel#action_12292 ]

    Robert Zeigler commented on CAY-763:
    ------------------------------------

    Any progress on this front?

    XML Deserialization fails on relationships when using a
    mapping file
    --------------------------------------------------------------------
    Key: CAY-763
    URL:
    https://issues.apache.org/cayenne/browse/CAY-763
    Project: Cayenne
    Issue Type: Bug
    Components: Cayenne Core Library
    Affects Versions: 1.2 [STABLE], 2.0 [STABLE]
    Environment: Any
    Reporter: Robert Zeigler
    Assigned To: Andrus Adamchik
    Attachments: cay-763.patch


    When XMLDecoder deserializes objects using a mapping
    descriptor, no
    objects are registered with a datacontext until after all objects
    have been initialized. However, cayenne requires a non- null
    datacontext to correctly handle relationships. Hence, dataobjects
    using the default cayenne handling of relationships
    (either to-one or
    to-many) will be unable to deserialize objects from XML
    (due to null
    pointers).
    In the case of a collection, the getXXX method will return
    null, and
    the XMLMappingDescriptor fails to "sense" a collection.
    In the case of a to-one relationship, a NPE exception is thrown
    trying to set the child property of the parent object.
    The simplest way to fix this would be to make XMLMappingDescriptor
    DataContext-capable (ie: will register objects with a
    datacontext, if
    one is provided, as the objects are created). I've done this in a
    local copy of the code. I will attach a patch when I get a minute.
    --
    This message is automatically generated by JIRA.
    -
    You can reply to this email to add a comment to the issue online.
  • Kevin Menard at Apr 26, 2007 at 5:17 pm
    Just to keep people in the loop, I'll be reviewing this in detail over
    the weekend. I did find the thread in question, and my memory may have
    just been off. Anyway, I hope to have a recommendation or resolution on
    this by Monday.

    --
    Kevin
    -----Original Message-----
    From: Andrus Adamchik
    Sent: Friday, April 20, 2007 9:53 AM
    To: dev@cayenne.apache.org
    Subject: Re: [JIRA] Commented: (CAY-763) XML Deserialization
    fails on relationships when using a mapping file

    Thanks for clarification. Now that I am looking closer at the
    patch, I think it is not that simple either.

    Andrus
  • Robert Zeigler at Apr 26, 2007 at 6:24 pm
    Cool.
    I admit my patch is probably a bit... simplistic, but, thus far, it
    works.
    And it seems "less broken" then throwing a NPE. :)
    So, looking forward to see what you come up with.

    Robert
    On Apr 26, 2007, at 4/2612:17 PM , Kevin Menard wrote:

    Just to keep people in the loop, I'll be reviewing this in detail over
    the weekend. I did find the thread in question, and my memory may
    have
    just been off. Anyway, I hope to have a recommendation or
    resolution on
    this by Monday.

    --
    Kevin
    -----Original Message-----
    From: Andrus Adamchik
    Sent: Friday, April 20, 2007 9:53 AM
    To: dev@cayenne.apache.org
    Subject: Re: [JIRA] Commented: (CAY-763) XML Deserialization
    fails on relationships when using a mapping file

    Thanks for clarification. Now that I am looking closer at the
    patch, I think it is not that simple either.

    Andrus

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupdev @
categoriescayenne
postedApr 19, '07 at 12:49p
activeApr 26, '07 at 6:24p
posts5
users3
websitecayenne.apache.org

People

Translate

site design / logo © 2021 Grokbase