-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Hibernate incompatible with Oracle 11g drivers + XDB?
PostPosted: Thu May 12, 2011 7:03 pm 
Beginner
Beginner

Joined: Thu Jun 21, 2007 9:24 pm
Posts: 20
Location: Lansing, Michigan, USA
I'm trying to demonstrate or disprove the feasibility of using a Hibernate user type that is stored as org.w3c.dom.Document on the Java side and Oracle's XMLType in the database. I'm basing my code on the example at http://community.jboss.org/wiki/MappingOracleXmlTypeToDocument.

Using Hibernate 3.6.0 Final and the Oracle 10g driver, "xdb.jar" and "xmlparserv2.jar", my code works for simple XML of the sort I expect to persist. (It does not work when the top-level tag is <html>; I'll post details of that issue elsewhere.) Swapping in the corresponding driver and two JAR files from Oracle 11g, I get the following error:

Code:
438 [main] ERROR org.hibernate.util.xml.ErrorLogger - Error parsing XML (31) : http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd<Line 31, Column 2>: XML-20068: (Fatal Error) content model is not deterministic
Initial SessionFactory Creation failed.  org.hibernate.InvalidMappingException: Unable to read XML
Exception in thread "main" java.lang.ExceptionInInitializerError
        at demo.hr.HibernateUtil.buildSessionFactory(HibernateUtil.java:34)
        at demo.hr.HibernateUtil.<clinit>(HibernateUtil.java:15)
        at java.lang.J9VMInternals.initializeImpl(Native Method)
        at java.lang.J9VMInternals.initialize(J9VMInternals.java:200)
        at demo.hr.AddDoc.main(AddDoc.java:54)
Caused by: org.hibernate.InvalidMappingException: Unable to read XML
        at org.hibernate.util.xml.MappingReader.readMappingDocument(MappingReader.java:101)
        at org.hibernate.cfg.Configuration.add(Configuration.java:510)
        at org.hibernate.cfg.Configuration.add(Configuration.java:506)
        at org.hibernate.cfg.Configuration.add(Configuration.java:686)
        at org.hibernate.cfg.Configuration.addResource(Configuration.java:771)
        at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.jav
a:2314)
        at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.jav
a:2280)
        at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:2260)
        at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:2213)
        at org.hibernate.cfg.Configuration.configure(Configuration.java:2128)
        at org.hibernate.cfg.Configuration.configure(Configuration.java:2107)
        at demo.hr.HibernateUtil.buildSessionFactory(HibernateUtil.java:20)
        ... 4 more
Caused by: org.dom4j.DocumentException: Error on line 31 of document http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd : http://hibernate.sourceforge.n
et/hibernate-mapping-3.0.dtd<Line 31, Column 2>: XML-20068: (Fatal Error) content model is not deterministic Nested exception: http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd<Line 31, Column 2>: XML-20068: (Fatal Error) content model is not deterministic
        at org.dom4j.io.SAXReader.read(SAXReader.java:482)
        at org.hibernate.util.xml.MappingReader.readMappingDocument(MappingReader.java:75)
        ... 15 more


My "hibernate.cfg.xml" file is as follows:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
                                         "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory name="">
  <property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
  <property name="hibernate.connection.password">HR</property>
  <property name="hibernate.connection.url">jdbc:oracle:thin:@localhost:1521:ORACLASS</property>
  <property name="hibernate.connection.username">HR</property>
  <property name="hibernate.dialect">org.hibernate.dialect.Oracle9iDialect</property>
  <property name="hibernate.connection.pool_size">1</property>
  <property name="hibernate.show_sql">true</property>
 
  <mapping class="demo.hr.DocBean" resource="demo/hr/DocBean.hbm.xml"/>
</session-factory>
</hibernate-configuration>


(Hibernate also prints a warning about an "obsolete hibernate namespace", but that's what JBoss Tools produced...)

Here's the one mapping file:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
                                   "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="demo.hr">
<class name="DocBean" table="docs">
  <id name="id" type="int" access="field" >
   <generator class="sequence-identity">
    <param name="sequence">seq</param>
   </generator>
  </id>
  <property generated="never" lazy="false" name="content" type="demo.hr.OracleXMLUserType" access="field" />
</class>
</hibernate-mapping>


Has anyone seen this? Does anyone know of an appropriate workaround, other than reverting to the Oracle 10g drivers?


Top
 Profile  
 
 Post subject: Re: Hibernate incompatible with Oracle 11g drivers + XDB?
PostPosted: Mon Jul 23, 2012 2:51 pm 
Newbie

Joined: Mon Jul 23, 2012 2:49 pm
Posts: 1
Has anyone found a solution for this problem yet?


Top
 Profile  
 
 Post subject: Re: Hibernate incompatible with Oracle 11g drivers + XDB?
PostPosted: Mon Feb 04, 2013 1:42 am 
Newbie

Joined: Sun Dec 30, 2012 12:44 pm
Posts: 4
try to use this dialect property ..
<property name="hibernate.dialect">org.hibernate.dialect.OracleDialect</property>

it worked for me.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.