-->
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.  [ 7 posts ] 
Author Message
 Post subject: Cache?
PostPosted: Wed Apr 28, 2004 9:17 am 
Beginner
Beginner

Joined: Tue Jan 27, 2004 8:25 am
Posts: 45
Hi, I'm trying to implement the Second Level cache, but I'm having some trouble when getting to the hibernate mapping...
I have inserted this line in my configuraiton file:
Code:
<property name="hibernate.cache.provider_class">net.sf.ehcache.hibernate.Provider</property>


and in my hibernate mapping file I inserted the cache tag as follows:
Code:
<class name="Agency">
   <cache usage="read-write"/>
   <id name="code" type="long" column="code"  unsaved-value="null">
      <generator class="native"/>
   </id>
   <property name="ord" type="long"/>
   <property name="name" type="string"/>
   <property name="ident" type="string"/>
   <property name="hotelCanFee" type="boolean"/>
   <property name="canHaveSubAllotment" type="boolean"/>
   <many-to-one name="postalAddress" class="PostalAddress" column="postalAddress"/>
   <many-to-one name="contactPerson" class="Person" column="contactPerson"/>
   <property name="logo" type="string"/>
   <many-to-one name="country" class="Country" column="country"/>
   <many-to-one name="language" class="Language" column="language"/>
   <many-to-one name="currency" class="Currency" column="currency"/>
   <property name="handlingFee" type="long"/>
   <property name="cancelDeadlinePlus" type="long"/>
   <set name="branchOffices" inverse="true" lazy="true" order-by="code" cascade="all">
      <cache usage="read-write"/>
       <key column="agency"/>
        <one-to-many class="BranchOffice"/>
    </set>   
</class>


So, when compiling I get this error:

Code:
org.xml.sax.SAXParseException: Element type "cache" must be declared.


What I'm doing wrong?

Thank you very much!


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 28, 2004 9:20 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Wrong/missing DTD Specification.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 28, 2004 9:25 am 
Beginner
Beginner

Joined: Tue Jan 27, 2004 8:25 am
Posts: 45
michael wrote:
Wrong/missing DTD Specification.


Sorry for the inconvenience, but I'm really a newbie with hibernate... could you specify a bit more please?
Thaks in advance!


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 28, 2004 9:30 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
I am pretty sure the DTD part in your mapping file is either missing or wrong.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 28, 2004 9:34 am 
Beginner
Beginner

Joined: Tue Jan 27, 2004 8:25 am
Posts: 45
michael wrote:
I am pretty sure the DTD part in your mapping file is either missing or wrong.


this is my header in my mapping file:

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


is this right?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 28, 2004 11:07 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Sounds like a parser problem to me ...


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 28, 2004 11:08 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Are you using a recent Hibernate version?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 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.