-->
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.  [ 4 posts ] 
Author Message
 Post subject: Configuring ecache with jboss-service.xml
PostPosted: Wed Aug 04, 2004 9:15 pm 
Newbie

Joined: Wed Aug 04, 2004 8:55 pm
Posts: 6
I am not sure how to configure ecache with my Hibernate JBoss service. The documentation at http://www.hibernate.org/66.html has helped me get the service running just fine, but I am not sure how to enable ecache and specify usage. I am using Hibernate 2.1.3.

Here is my jboss-service.xml file and my best guess at how to enable caching in the mbean (<attribute name="CacheUsage">read-write</attribute>). But this does not seem to work. Should I be using a separate ecache.xml file? If so, is there an example online that works with the hibernate.sar?

Thanks in advance.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE server>

<server>
<mbean code="net.sf.hibernate.jmx.HibernateService" name="jboss.jca:service=TrialBuilderHibernate">
<depends>jboss.jca:service=RARDeployer</depends>
<depends>jboss.jca:service=LocalTxCM,name=TBOracleDS</depends>
<attribute name="MapResources">
com/novartis/edms/tb/entities/Actobj.hbm.xml,
com/novartis/edms/tb/entities/CheckOutTrial.hbm.xml,
com/novartis/edms/tb/entities/Choice.hbm.xml,
com/novartis/edms/tb/entities/ChoiceList.hbm.xml,
com/novartis/edms/tb/entities/ChoiceLists.hbm.xml,
com/novartis/edms/tb/entities/Evaluation.hbm.xml,
com/novartis/edms/tb/entities/Field.hbm.xml,
com/novartis/edms/tb/entities/RunField.hbm.xml,
com/novartis/edms/tb/entities/FontObj.hbm.xml,
com/novartis/edms/tb/entities/RuleBook.hbm.xml,
com/novartis/edms/tb/entities/Rule.hbm.xml,
com/novartis/edms/tb/entities/Page.hbm.xml,
com/novartis/edms/tb/entities/SubPage.hbm.xml,
com/novartis/edms/tb/entities/PageLite.hbm.xml,
com/novartis/edms/tb/entities/PublishedTrial.hbm.xml,
com/novartis/edms/tb/entities/Trial.hbm.xml,
com/novartis/edms/tb/entities/TrialLite.hbm.xml,
com/novartis/edms/tb/entities/CustUserParm.hbm.xml,
com/novartis/edms/tb/entities/StudyUserParm.hbm.xml,
com/novartis/edms/tb/entities/Valobj.hbm.xml,
com/novartis/edms/tb/entities/Visit.hbm.xml,
com/novartis/edms/tb/entities/VisitPage.hbm.xml
</attribute>
<attribute name="JndiName">java:/HibernateFactory</attribute>
<attribute name="Datasource">java:/TBOracleDS</attribute>
<attribute name="Dialect">net.sf.hibernate.dialect.OracleDialect</attribute>
<!-- Use the default value. attribute name="UseOuterJoin">true</attribute-->
<attribute name="ShowSql">false</attribute>
<attribute name="UserTransactionName">UserTransaction</attribute>
<attribute name="TransactionStrategy">net.sf.hibernate.transaction.JTATransactionFactory</attribute>
<attribute name="TransactionManagerLookupStrategy">net.sf.hibernate.transaction.JBossTransactionManagerLookup</attribute>
<attribute name="CacheProvider">net.sf.ehcache.hibernate.Provider</attribute>
<attribute name="CacheUsage">read-write</attribute>
</mbean>

</server>


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 04, 2004 9:38 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
At least in the latest release, the HibernateServiceMBean has a property named cacheProvider.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 05, 2004 11:39 am 
Newbie

Joined: Wed Aug 04, 2004 8:55 pm
Posts: 6
So Gavin I think you are suggesting that there is no way to enable the ecache when using Hibernate as a MBean unless I use versioon 2.1.5. is that correct?

Regards,
Rutherford


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 20, 2004 2:14 pm 
Newbie

Joined: Tue Jul 13, 2004 11:39 pm
Posts: 1
I have this working.

Config JBoss 3.2.4 & Hibernate 2.1.6.

Following http://www.hibernate.org/158.html, I had to make 1 change
to get ehcache to load at startup.

I had to use 'net.sf.ehcache.hibernate.Provider' for Hibernate 2.1.6 even though the wiki seemed to suggest using 'net.sf.hibernate.cache.EhCache' for 2.1.5 and above.

So, in short:

Add the following line to your jboss-service.xml:
<attribute name="CacheProviderClass">net.sf.ehcache.hibernate.Provider</attribute>

Add the ehcache.xml file to your sar file.

Enable the cache in each mapping file.

Chapter 5 in Hibernate In Action covers this in detail as well.

Hope this helps,
Jeff Hunter
jeff.hunter(at)ums.msfc.nasa(dot)gov


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