Hello,
Hibernate version: 3.05
Name and version of the database you are using:Oracle 9.2
I would like to use Oracle XMLType.
So, I create a class witch implements UserType.
Code:
public class OracleXMLType implements UserType, Serializable {
/**
*
*/
private static final long serialVersionUID = -6722439738091377161L;
private static Log log = LogFactory.getLog(OracleXMLType.class);
private static final int[] SQL_TYPES = new int[] { oracle.xdb.XMLType._SQL_TYPECODE };
private static final Class RETURNED_CLASSES = String.class;
/**
* @see org.hibernate.usertype.UserType#sqlTypes()
*/
public int[] sqlTypes() {
StringBuffer buffer = new StringBuffer();
for (int i = 0; i < SQL_TYPES.length; i++) {
buffer.append(SQL_TYPES[i]).append(";");
}
log.info(buffer.toString());
return SQL_TYPES;
}
/**
* @see org.hibernate.usertype.UserType#returnedClass()
*/
public Class returnedClass() {
return RETURNED_CLASSES;
}
[...]
Mapping documents:To uses OracleXMLType, I map this like :
Code:
<hibernate-mapping package="fr.test.model.persistance">
<class name="XMLBody" table="XML_BODY">
<id name="dbId" column="XML_BODY_DB_ID">
<generator class="assigned"></generator>
</id>
<property name="body"
type="fr.test.service.persistance.OracleXMLType"
column="XML_BODY_BODY"
not-null="true">
</property>
</class>
</hibernate-mapping>
Code:
<hibernate-configuration>
<session-factory>
<!-- Enable CGLIB reflection optimizer (enabled by default) -->
<property name="hibernate.cglib.use_reflection_optimizer">false</property>
<!-- With Application Server -->
<property name="connection.datasource">jdbc/etso</property>
<property name="show_sql">true</property>
<property name="dialect">org.hibernate.dialect.Oracle9Dialect</property>
<!-- Mapping files -->
resource="fr/test/model/persistance/XMLBody.hbm.xml"/>
</session-factory>
</hibernate-configuration>
Full stack trace of any exception that occurs:
When export the schema with schema export, I have a "
Schema text failed"
Quote:
[schemaexport] 19 août 2005 15:52:53 org.hibernate.cfg.Configuration secondPassCompile
[schemaexport] INFO: processing foreign key constraints
[schemaexport] 19 août 2005 15:52:54 fr.rte.etso.service.persistance.OracleXMLType sqlTypes
[schemaexport] INFO: 2007;
BUILD FAILED
C:\logiciel\eclipse-SDK-3.1.0-win32\workspace\EtsoPrototype\build.xml:24: Schema text failed: No Dialect mapping for JDBC type: 2007
The value 2007 is the oracle.xdb.XMLType._SQL_TYPECODE.
So, I ask you if people knows the dialect to used to generate XMLType ?
Thx for your help !!