EclipseLink has support for XMLType in Oracle using the DirectToXMLTypeMapping, but there is no annotation support for this mapping, nor support for other database platforms. Although I think you can just map any XMLType just as a String and have it work.
EclipseLink Expressions support XPath based query extensions, but there is no JPQL support for these functions as of yet. You could potentially use the generic FUNC operator in JPQL (as of EclipseLink 2.1).
You could define an EclipseLink Converter to marshal an object to/from XML in a mapping.
Please log an enhancement request for this feature and vote for it.
thanks for your hints. I went for the converter option and it works quite well.
For defining the target field type in DB (I need a clob) I read on the mailinglists that I have to override initialize(DatabaseMapping mapping, Session session) and specifiy the type there via mapping.getField().setSQLType(Types.CLOB). However, this (and some variations to setting the field type) didn't work out and the generated type in the DB was always varchar.
finally, I tried ((DirectToFieldMapping)mapping).setFieldClassification(Class Constants.CLOB);, which delivered the expected results.
Is this the right way to define the target type or should mapping.getField().setSQLType(Types.CLOB) also work out?