Re: extended type and subclasses

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Wed May 03 2006 - 08:23:44 EDT

  • Next message: Andrus Adamchik: "Re: [JIRA] Created: (CAY-538) Relationship not refreshed before committing the context."

    On May 3, 2006, at 7:50 AM, Tore Halset wrote:

    > Hello.
    >
    > I am using an ExtendedType to map a JTS Geometry to a CLOB as done
    > here:
    >
    > http://objectstyle.org/confluence/display/CAY/Mapping+JTS+Geometries
    >
    > This has been working ok, but I have only used it for reading.
    > Trying to use the same ExtendedType for writing got me into an
    > annoying problem. On writing I typically set a Polygon or
    > MultiPolygon on the CayenneDataObject. P and MP are both subclasses
    > of the mapped Geometry, but are not mapped correctly as the map
    > only contains class names.
    >
    > I have updated the example in the wiki to reflect this "problem".
    >
    > Perhaps ExtendedType should map a Class (and handle subclasses)
    > instead of a String holding a class name? Just wanted to discuss it
    > here before creating a feature request for it.
    >
    > Regards,
    > - Tore.

    Yeah, let's open a feature request for it. As for using Class instead
    of String class name as map keys - this can cause troubles with
    nested ClassLoaders. I guess instead we may reimplement
    'ExtendedTypeMap.getRegisteredType(Class)' to scan the class
    hierarchy up to, but not including, java.lang.Object before falling
    back to a default type.

    Andrus



    This archive was generated by hypermail 2.0.0 : Wed May 03 2006 - 08:24:09 EDT