0
Entity код Java:Mapping оракул XmlType с OpenJPA 2.2.2
@Column(name="XMLCOL", columnDefinition="XMLTYPE")
private String xmlcol;
public String getXmlcol() {
return xmlcol;
}
public void setXmlcol(String xmlcol) {
this.xmlcol = xmlcol;
}
Таблица Столбец Тип данных:
XMLCOL PUBLIC.XMLTYPE STORAGE BINAR
Каждый раз, когда я получаю данные XML, как NULL. Не удалось получить данные.
Пробовал @ColumnTransformer(read = "to_clob(columnName)", write = "?")
, но не работает. Также получение ниже исключения
Exception in thread "main" <openjpa-2.2.2-r422266:1468616 fatal user error> org.apache.openjpa.persistence.ArgumentException: "com.javawebtutor.Supplier.xmlcol" declares a column that is not compatible with the expected type "varchar". Column details:
Full Name: Supplier.XMLCOL
Type: unknown(2009)
Size: 2000
Default: null
Not Null: false
Добавление persistence.xml
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="jpa">
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
<class>com.javawebtutor.Supplier</class>
<properties>
<property name="openjpa.jdbc.SchemaFactory" value="native"/>
<property name="javax.persistence.jdbc.url" value="jdbc:oracle:thin:@localhost:1521:xe"/>
<property name="javax.persistence.jdbc.user" value="***"/>
<property name="javax.persistence.jdbc.password" value="***"/>
<property name="javax.persistence.jdbc.driver" value="oracle.jdbc.OracleDriver"/>
<property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/>
<property name="openjpa.RuntimeUnenhancedClasses" value="supported"/>
</properties>
</persistence-unit>
</persistence>
Заранее спасибо.