[DISCUSS 1]:
Many database systems now have support for XML types which includes DB2 v9.1,
DB2 zOS v9, Oracle 10g, and SQLServer 2005.
Tables may contain XML columns where you can store XML documents.
What is OpenJPA's position of supporting the XML columns ?
The current mapping choices for XML columns are:
1.  Java String
2.  Java Byte array

Can openjpa provide other mapping options for XML columns?
 [DISCUSS 2]:
Should XML mapping function be considered a new feature ?

[DISCUSS 3]:
My second part of the discussion is related to an XML Value Handler that I
implemented by extending AbstractValueHandler as described under Mapping
Extensions of OpenJPA developer'sGguide. My implementation has dependency on
JAXB bindings.
This XmlValueHandler is annotated on @Strategy("XmlValueHandler") for the
field that maps to XML column.

My XmlValueHandler worked fine for inserts and deletes, but not for updates.

The problem in updates is that the value passed to toDataStoreValue() is
wrapped in a Proxy, I can't get the original Class for the value object.
val.getClass() is returning the Proxy wrapped class, not the original class.

To workaround it, I have to use some klugy code - checking if val is a
proxy or not.

Is there a better way to find out the actual class from a proxy ?


   public Object toDataStoreValue(ValueMapping vm, Object val,
       JDBCStore store) {
       // check for null value.
       if (val==null) return null;
       try {
           //JAXBContext jc = JAXBContext.newInstance(val.getClass());
           JAXBContext jc = JAXBContext.newInstance(
                   // on update val is a proxy, that can not be marshalled.
                   // use the declared type in this case.
                   (val.getClass().getName().contains("$proxy"))
                            ? vm.getDeclaredType()
                            : val.getClass());
           Marshaller m = jc.createMarshaller();
           Writer result = new StringWriter();
           m.marshal( val, result );
           return result.toString();
       }


Catalina

Reply via email to