<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">

<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>

                                <td>

                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="http://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>

                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px;  -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
    caching the entities using EJB 3.0 for JBoss.
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="http://community.jboss.org/people/psadha">prabha ramasamy</a> in <i>JBoss Cache</i> - <a href="http://community.jboss.org/message/634406#634406">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>We are using the following approach to cache the entities using EJB 3.0 for JBoss.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Persistnce.xml changes :</p><p>&#160; </p><p>&lt;persistence-unit name="OracleDatabase" transaction-type="JTA"&gt;</p><p>&#160; &lt;provider&gt;org.hibernate.ejb.HibernatePersistence&lt;/provider&gt;</p><p>&#160; &lt;jta-data-source&gt;java:/ClientPointeDS&lt;/jta-data-source&gt;</p><p>&#160; </p><p>&#160; &lt;properties&gt;</p><p>&#160;&#160; &lt;property name="hibernate.dialect" value="org.hibernate.dialect.Oracle9Dialect" /&gt;</p><p>&#160;&#160; &lt;property name="hibernate.show_sql" value="true" /&gt;</p><p>&#160;&#160; &lt;!-- These are the default for JBoss EJB3 --&gt;</p><p>&#160;&#160;&#160; &lt;property name="hibernate.cache.provider_class"&#160; value="org.hibernate.cache.HashtableCacheProvider" /&gt;</p><p>&#160;&#160; &lt;property name="hibernate.transaction.manager_lookup_class"&#160; value="org.hibernate.transaction.JBossTransactionManagerLookup" /&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;property name="jboss.entity.manager.factory.jndi.name"&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; value="java:/EntityManagerFactories/oracleDatabase" /&gt;</p><p>&#160; </p><p>&#160;&#160; </p><p>&#160; </p><p>&#160;&#160; &lt;!--&#160; JBoss Cache Related Changes&#160; --&gt;</p><p>&lt;!--&#160;&#160; &lt;property name="hibernate.cache.use_second_level_cache" value="true"/&gt;--&gt;</p><p>&lt;!--&#160;&#160; &lt;property name="hibernate.cache.use_query_cache" value="true"/&gt;--&gt;</p><p>&lt;!--&#160;&#160; &lt;property name="hibernate.cache.region.factory_class" value="org.hibernate.cache.jbc2.JndiMultiplexedJBossCacheRegionFactory"/&gt;--&gt;</p><p>&lt;!--&#160;&#160; &lt;property name="hibernate.cache.region.jbc2.cachefactory" value="java:CacheManager"/&gt;--&gt;</p><p>&lt;!--&#160;&#160; &lt;property name="hibernate.cache.region.jbc2.cfg.entity" value="mvcc-entity"/&gt;--&gt;</p><p>&lt;!--&#160;&#160; &lt;property name="hibernate.cache.region.jbc2.cfg.query" value="local-query"/&gt;--&gt;</p><p>&lt;!--&#160;&#160; &lt;property name="hibernate.show_sql" value="true"/&gt;--&gt;</p><p>&#160;&#160; </p><p>&#160;&#160; </p><p>&#160;&#160;&#160; &lt;property name="hibernate.cache.provider_class" value="org.jboss.ejb3.entity.TreeCacheProviderHook"/&gt;</p><p>&#160;&#160; </p><p>&#160;&#160;&#160;&#160; &lt;property name="hibernate.treecache.mbean.object_name"&#160; value="jboss.cache:service=EJB3EntityTreeCache"/&gt;</p><p>&#160;&#160;&#160;&#160; </p><p>&#160;&#160;&#160;&#160; &lt;!-- &lt;property name="hibernate.ejb.classcache.services.entities.InstitutionData" value="transactional"/&gt;</p><p>&#160;&#160;&#160;&#160;&#160; &lt;property name="hibernate.ejb.classcache.services.entities.InstitutionStatus" value="transactional"/&gt; --&gt;</p><p>&#160;&#160; </p><p>&#160;&#160;&#160; &lt;property name="hibernate.cache.use_query_cache" value="true"/&gt; </p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160; &lt;property name="hibernate.cache.region.factory_class" value="org.hibernate.cache.jbc2.JndiMultiplexedJBossCacheRegionFactory"/&gt; </p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160; &lt;property name="hibernate.cache.region.jbc2.cachefactory" value="java:CacheManager"/&gt; </p><p>&#160;&#160; </p><p>&#160;&#160; &lt;property name="hibernate.cache.region.jbc2.cfg.entity" value="mvcc-entity"/&gt; </p><p>&#160;&#160; </p><p>&#160;&#160; &lt;property name="hibernate.cache.region.jbc2.cfg.collection" value="mvcc-entity"/&gt;&#160; </p><p>&#160;&#160; </p><p>&#160; &lt;/properties&gt;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><br/>@XmlRootElement(name="institutionData")<br/>@XmlType(propOrder={})<br/>@Cache(usage=CacheConcurrencyStrategy.TRANSACTIONAL)<br/>public class InstitutionData {</p><p>&#160; /**<br/>&#160;&#160; * Apache Logger reference<br/>&#160;&#160; */&#160; <br/> </p><p><br/> } </p><p><br/> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p> We are getting the following Exception</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160; </p><p>[SessionFactoryImpl] building session factory</p><p>15:50:44,520 INFO [JndiMultiplexingCacheInstanceManager] Unable to retreive Cache from JNDI [java:CacheManager]</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160; </p><p>[SessionFactoryImpl] building session factory</p><p>15:50:44,520 INFO&#160; [JndiMultiplexingCacheInstanceManager] Unable to retreive Cache from JNDI [java:CacheManager]</p><p>javax.naming.NameNotFoundException: CacheManager not bound</p><p> at org.jnp.server.NamingServer.getBinding(NamingServer.java:771)</p><p> at org.jnp.server.NamingServer.getBinding(NamingServer.java:779)</p><p> at org.jnp.server.NamingServer.getObject(NamingServer.java:785)</p><p> at org.jnp.server.NamingServer.lookup(NamingServer.java:443)</p><p> at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:726)</p><p> at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:686)</p><p> at javax.naming.InitialContext.lookup(InitialContext.java:392)</p><p> at org.hibernate.cache.jbc2.builder.JndiMultiplexingCacheInstanceManager.locateCacheFactory(JndiMultiplexingCacheInstanceManager.java:83)</p><p> at org.hibernate.cache.jbc2.builder.JndiMultiplexingCacheInstanceManager.start(JndiMultiplexingCacheInstanceManager.java:72)</p><p> at org.hibernate.cache.jbc2.JBossCacheRegionFactory.start(JBossCacheRegionFactory.java:106)</p><p> at org.hibernate.impl.SessionFactoryImpl.&lt;init&gt;(SessionFactoryImpl.java:215)</p><p> at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1327)</p><p> at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)</p><p> at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)</p><p> at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:132)</p><p> at org.jboss.jpa.deployment.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:301)</p><p> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><br/> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><br/> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><br/> </p></div>

<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
    <p style="margin: 0;">Reply to this message by <a href="http://community.jboss.org/message/634406#634406">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in JBoss Cache at <a href="http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2052">Community</a></p>
</div></td>
                        </tr>
                    </tbody>
                </table>


                </td>
            </tr>
        </tbody>
    </table>

</div>

</body>
</html>