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 3.2.4 Mapping Problem (with cache enabled)
PostPosted: Mon May 14, 2007 7:34 pm 
Beginner
Beginner

Joined: Fri Apr 22, 2005 5:58 pm
Posts: 26
I have an app that has been running without a 2nd level cache for a couple years... so I am pretty familiar with the Hibernate technology. I am going through the steps of upgrading from 3.0.5 to 3.2.4, and at the same time I am introducing some cacheing. I have everything working with 3.2.4, but when I add:

Code:
<cache usage="read-only"/>


to my hibernate-mapping file I get the following error. I have checked the DTD included in the JAR as well as the DTD online and both seem to look like this should work.

Code:
2007-05-14 19:19:52,816 ERROR [main] (XMLHelper.java:61) - Error parsing XML: XML InputStream(30) The content of element type "class" must match "(meta*,subselect?,cache?,synchronize*,comment?,tuplizer*,(id|composite-id),discriminator?,natural-id?,(version|timestamp)?,(property|many-to-one|one-to-on
e|component|dynamic-component|properties|any|map|set|list|bag|idbag|array|primitive-array)*,((join*,subclass*)|joined-subclass*|union-subclass*),loader?,sql-insert?,sql-update?,sql-delete?,filter*,resultset*,(query|sql-query)*)".
2007-05-14 19:19:52,910 ERROR [main] (HibernateUtil.java:42) - org.hibernate.InvalidMappingException: Could not parse mapping document from resource com/connectfirst/intelliqueue/model/Account.hbm.xml
org.hibernate.InvalidMappingException: Could not parse mapping document from resource com/connectfirst/intelliqueue/model/Account.hbm.xml
        at org.hibernate.cfg.Configuration.addResource(Configuration.java:569)
        at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1587)
        at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1555)
        at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1534)
        at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1508)
        at org.hibernate.cfg.Configuration.configure(Configuration.java:1428)
        at org.hibernate.cfg.Configuration.configure(Configuration.java:1414)
        at com.connectfirst.intelliqueue.utils.HibernateUtil.<clinit>(HibernateUtil.java:36)
        at com.connectfirst.intelliqueue.IntelliQueue.startup(IntelliQueue.java:97)
        at com.connectfirst.intelliqueue.IntelliQueue.main(IntelliQueue.java:55)
Caused by: org.hibernate.InvalidMappingException: Could not parse mapping document from invalid mapping
        at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:502)
        at org.hibernate.cfg.Configuration.addResource(Configuration.java:566)
        ... 9 more
Caused by: org.xml.sax.SAXParseException: The content of element type "class" must match "(meta*,subselect?,cache?,synchronize*,comment?,tuplizer*,(id|composite-id),discriminator?,natural-id?,(version|timestamp)?,(property|many-to-one|one-to-one|component|dynamic-component|properties|any|map|set|lis
t|bag|idbag|array|primitive-array)*,((join*,subclass*)|joined-subclass*|union-subclass*),loader?,sql-insert?,sql-update?,sql-delete?,filter*,resultset*,(query|sql-query)*)".
        at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
        at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
        at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
        at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
        at org.apache.xerces.impl.dtd.XMLDTDValidator.handleEndElement(Unknown Source)
        at org.apache.xerces.impl.dtd.XMLDTDValidator.endElement(Unknown Source)
        at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
        at org.dom4j.io.SAXReader.read(SAXReader.java:334)
        at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:499)
        ... 10 more



Here is my complete hibernate-mapping file:

Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping>

    <class name="com.connectfirst.intelliqueue.model.Account" table="tbl_acd_accounts">
        <id name="accountID" type="string" column="account_ID"/>
       
        <property name="accountName" column="account_name" length="100" not-null="true"/>
        <property name="offHookHold" column="off_hook_hold"/>
        <property name="offHookWhisper" column="off_hook_whisper"/>
        <property name="offHookWhisperGhost" column="off_hook_whisper_ghost"/>
        <property name="outboundPrepay" column="outbound_prepay"/>
        <property name="defaultOutdialServerGroupId" column="default_outdial_server_group_id"/>
        <property name="overrideDispositions" column="override_dispositions"/>
       
        <set name="gateGroups" inverse="true" cascade="all,delete-orphan">
            <key column="account_id"/>
            <one-to-many class="com.connectfirst.intelliqueue.model.GateGroup"/>
        </set>
       
        <set name="agents" table="tbl_acd_accounts_agents" lazy="true">
            <key column="account_id"/>
            <many-to-many class="com.connectfirst.intelliqueue.model.Agent" column="agent_id"/>
        </set>
   
        <cache usage="read-only" />
    </class>
   
</hibernate-mapping>


Thanks in advance!
Geoff


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 15, 2007 2:54 am 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
The error message is pretty specific. It's an ordering issue: <cache> must come before <id>. To be precise, it must come after <subselect> and before <synchronize> (if they exist).

_________________
Code tags are your friend. Know them and use them.


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 15, 2007 7:40 am 
Beginner
Beginner

Joined: Fri Apr 22, 2005 5:58 pm
Posts: 26
Thanks.


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.