Hi All,
I posted this very same question on
stackoverflow.com but haven't find a valid solution yet therefore I am sending this question to the mailing list as well. Hoping there's more EclipseLink audiences here.
I am new to JPA, and I have a question on how to use JPA to store XML type to PostgreSQL. I am simply expanding an existing entity class to persist an additional XML field to a column. The entity class looks something like this (I purposely left out a bunch of other columns to make this shorter, before adding this additional XML type, this entity class can persist into PostgreSQL just fine via JPA).
@Entity
@Table(name = "FINDING")
public class Finding implements Serializable {
private static final long serialVersionUID = -5814053129578212916L;
...
@Column(name = "PLUGIN_TEXT_XML")
private String pluginTextXML;
public void setPluginText(String pluginText) {
this.pluginText = pluginText;
}
public String getPluginTextXML() {
return pluginTextXML;
}
}
When I try to persist this entity, I received a PSQLException
Caused by: org.postgresql.util.PSQLException: ERROR: column "plugin_text_xml" is of type xml but _expression_ is of type character varying
Hint: You will need to rewrite or cast the _expression_.
Position: 668
I have been trying to look online on how to map a XML type in JPA but no luck. I also tried to implement a DescriptorCustomizer as documented in this online post but no luck as well.
http://stackoverflow.com/questions/3961237/mapping-oracle-xmltype-on-jpa-eclipselink
If anyone can give me a hand or point me to a site online so I can read up more on it then it would be a great help! Thank you for reading!