Search code examples
oraclejpaoracle11gjpa-2.0eclipselink

Insert/Update of XMLType with JPA


I have an oracle database with a column with XMLType. I have implemented a DescriptorCustomizer for it and I am using XMLType as my field type in the Entity.

Essentially I have:

@Entity
@Customizer(XmlCustomizer.class) 
public class ...... {
    .....
private XMLType xmlColumn;
    .....
}

This all works great for reading data from the database. But when it comes to persisting the data I am not sure what to do. I haven't found an easy way to create an XMLType object with xml in it. Most of the methods seem to ask for a connection which is pretty ugly. So what is it that I am missing or misunderstanding?

Thanks.

EDIT: I forgot to mention that I do have it working with XMLType but like I said I have to pass a connection to the database which I can get from my EntityManager. Seems ugly though.


Solution

  • The latest EclipseLink (2.4) seems to convert XMLType straight into String without the need for a customizer.