Hi Kamil,
I add the hibernate.cache.use_second_level_cache property as you said, but without success
(I believe that is true by default)
We are using Hibernate through JPA, so I tried with the find method and createQuery of the
EntityManager. In the both executions, the SQL code appears in the console, so, the
conclusion is that cache its not working because is going in the database (and the
performace do not change too)
The code:
Find by id
| public void findByIdTest() {
| long initTime= System.currentTimeMillis();
| Fund f = em.find(Fund.class, 1718);
| System.out.println(f);
| HomeOnShoreFund h = em.find(HomeOnShoreFund.class, 91);
| System.out.println(h);
| MarketOnShoreFund m = em.find(MarketOnShoreFund.class, "143812");
| System.out.println(m);
|
System.out.println("Spent:"+(System.currentTimeMillis()-initTime)+"\n");
| }
|
Find all
| public void findAllTest() {
| long initTime= System.currentTimeMillis();
| List resultList1 = em.createQuery("from " +
Fund.class.getName()).getResultList();
| System.out.println("Funds:"+resultList1.size());
| List resultList2 = em.createQuery("from " +
MarketOnShoreFund.class.getName()).getResultList();
| List resultList3 = em.createQuery("from " +
HomeOnShoreFund.class.getName()).getResultList();
|
System.out.println("Spent:"+(System.currentTimeMillis()-initTime)+"\n");
| }
|
persistence.xml
| <?xml version="1.0" encoding="UTF-8"?>
| <persistence
xmlns="http://java.sun.com/xml/ns/persistence"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
|
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
version="1.0">
| <persistence-unit name="FrameworkHG_PU">
| <jta-data-source>java:/jca/FrameworkHG-Oracle-DS</jta-data-source>
| <properties>
| <property name="hibernate.dialect"
value="org.hibernate.dialect.Oracle10gDialect" />
| <property name="hibernate.show_sql" value="true" />
| <property name="hibernate.format_sql" value="true" />
| <property name="hibernate.use_sql_comments" value="false"
/>
| <property name="jboss.entity.manager.jndi.name"
value="java:/FrameworkHGEntityManager" />
| <property name="jboss.entity.manager.factory.jndi.name"
value="java:/FrameworkHGEntityManagerFactory"/>
| <property name="hibernate.cache.provider_class"
value="org.jboss.ejb3.entity.TreeCacheProviderHook"/>
| <property name="hibernate.treecache.mbean.object_name"
value="jboss.cache:service=EJB3EntityTreeCache"/>
| <property name="hibernate.cache.use_second_level_cache"
value="true" />
| </properties>
| </persistence-unit>
| </persistence>
|
Something is wrong?
thank-you
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4167076#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...