<!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;"> </p><p>Persistnce.xml changes :</p><p>  </p><p><persistence-unit name="OracleDatabase" transaction-type="JTA"></p><p>  <provider>org.hibernate.ejb.HibernatePersistence</provider></p><p>  <jta-data-source>java:/ClientPointeDS</jta-data-source></p><p>  </p><p>  <properties></p><p>   <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle9Dialect" /></p><p>   <property name="hibernate.show_sql" value="true" /></p><p>   <!-- These are the default for JBoss EJB3 --></p><p>    <property name="hibernate.cache.provider_class"  value="org.hibernate.cache.HashtableCacheProvider" /></p><p>   <property name="hibernate.transaction.manager_lookup_class"  value="org.hibernate.transaction.JBossTransactionManagerLookup" /></p><p>            <property name="jboss.entity.manager.factory.jndi.name"         value="java:/EntityManagerFactories/oracleDatabase" /></p><p>  </p><p>   </p><p>  </p><p>   <!--  JBoss Cache Related Changes  --></p><p><!--   <property name="hibernate.cache.use_second_level_cache" value="true"/>--></p><p><!--   <property name="hibernate.cache.use_query_cache" value="true"/>--></p><p><!--   <property name="hibernate.cache.region.factory_class" value="org.hibernate.cache.jbc2.JndiMultiplexedJBossCacheRegionFactory"/>--></p><p><!--   <property name="hibernate.cache.region.jbc2.cachefactory" value="java:CacheManager"/>--></p><p><!--   <property name="hibernate.cache.region.jbc2.cfg.entity" value="mvcc-entity"/>--></p><p><!--   <property name="hibernate.cache.region.jbc2.cfg.query" value="local-query"/>--></p><p><!--   <property name="hibernate.show_sql" value="true"/>--></p><p>   </p><p>   </p><p>    <property name="hibernate.cache.provider_class" value="org.jboss.ejb3.entity.TreeCacheProviderHook"/></p><p>   </p><p>     <property name="hibernate.treecache.mbean.object_name"  value="jboss.cache:service=EJB3EntityTreeCache"/></p><p>     </p><p>     <!-- <property name="hibernate.ejb.classcache.services.entities.InstitutionData" value="transactional"/></p><p>      <property name="hibernate.ejb.classcache.services.entities.InstitutionStatus" value="transactional"/> --></p><p>   </p><p>    <property name="hibernate.cache.use_query_cache" value="true"/> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>   <property name="hibernate.cache.region.factory_class" value="org.hibernate.cache.jbc2.JndiMultiplexedJBossCacheRegionFactory"/> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>   <property name="hibernate.cache.region.jbc2.cachefactory" value="java:CacheManager"/> </p><p>   </p><p>   <property name="hibernate.cache.region.jbc2.cfg.entity" value="mvcc-entity"/> </p><p>   </p><p>   <property name="hibernate.cache.region.jbc2.cfg.collection" value="mvcc-entity"/>  </p><p>   </p><p>  </properties></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><br/>@XmlRootElement(name="institutionData")<br/>@XmlType(propOrder={})<br/>@Cache(usage=CacheConcurrencyStrategy.TRANSACTIONAL)<br/>public class InstitutionData {</p><p>  /**<br/>   * Apache Logger reference<br/>   */  <br/> </p><p><br/> } </p><p><br/> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p> We are getting the following Exception</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>  </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;"> </p><p>  </p><p>[SessionFactoryImpl] building session factory</p><p>15:50:44,520 INFO  [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.<init>(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;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><br/> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><br/> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </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>