Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Support for XML column types?
Support for XML column types? [message #634317] Thu, 21 October 2010 09:18 Go to next message
marco is currently offline marco
Messages: 21
Registered: May 2010
Junior Member
Hello,

OpenJPA supports the mapping of entity properties, which have JAXB binding annotations as described here. I would like to know whether a similar feature is planned for EL in the near future?

thanks,
marco
Re: Support for XML column types? [message #634447 is a reply to message #634317] Thu, 21 October 2010 18:13 Go to previous messageGo to next message
James Sutherland is currently offline James Sutherland
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

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.



James : Wiki : Book : Blog : Twitter
Re: Support for XML column types? [message #637762 is a reply to message #634447] Mon, 08 November 2010 18:18 Go to previous messageGo to next message
marco is currently offline marco
Messages: 21
Registered: May 2010
Junior Member
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?

thanks,
marco
Re: Support for XML column types? [message #638512 is a reply to message #637762] Thu, 11 November 2010 14:41 Go to previous messageGo to next message
James Sutherland is currently offline James Sutherland
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

The sqlType on the DatabaseField defines how it is accessed through JDBC.

The type used for schema creation is derived from the type (setType(Clob.class)). Or can be defined directly by the columnDefinition (setColumnDefinition("CLOB")).


James : Wiki : Book : Blog : Twitter
Re: Support for XML column types? [message #638521 is a reply to message #638512] Thu, 11 November 2010 15:03 Go to previous message
marco is currently offline marco
Messages: 21
Registered: May 2010
Junior Member
thanks, that worked
Previous Topic:Inheritance bug?: super class instantiated instead of sub class
Next Topic:Handling files using lob in entity
Goto Forum:
  


Current Time: Sun Sep 21 12:24:46 GMT 2014

Powered by FUDForum. Page generated in 0.10146 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software