extended type and subclasses
----------------------------

         Key: CAY-540
         URL: http://issues.apache.org/cayenne/browse/CAY-540
     Project: Cayenne
        Type: Improvement

  Components: Cayenne Core Library  
    Versions: 1.2 [BETA]    
    Reporter: Tore Halset
    Priority: Minor
     Fix For: AFTER 1.2


Tore:
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.

Andrus:
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.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/cayenne/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to