-->
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.  [ 2 posts ] 
Author Message
 Post subject: I am Not able to objects from the cache
PostPosted: Thu Mar 20, 2008 9:49 am 
Newbie

Joined: Tue Aug 28, 2007 8:22 am
Posts: 2
I have an entity mapped from a database view. It has a primary key field as well.

@Entity(name = "VAwaitedDocs")
@Table(schema = "OPS_TRACKING", name = "V_AWAITED_DOCS")
@Cache(usage= org.hibernate.annotations.CacheConcurrencyStrategy.READ_ONLY)
@NamedQuery(name="findAll",
query="select v from VAwaitedDocs v",
hints={@QueryHint(name="org.hibernate.cachemode", value="GET"), @QueryHint(name="org.hibernate.cacheable", value="true"), @QueryHint(name="org.hibernate.cacheRegion", value="opstraing.model.VAwaitedDocs")})
public class VAwaitedDocs implements Serializable {
.
.
. @Id
@Column(name = "TRADE_RQMT_ID", nullable = false, length = 12)
public Long getTradeRqmtId() {
return tradeRqmtId;
}

In my persistence file, i am using jboss cache.

<property name="hibernate.cache.provider_class" value="org.jboss.ejb3.entity.TreeCacheProviderHook"/>
<property name="hibernate.treecache.mbean.object_name" value="jboss.cache:service=EJB3EntityTreeCache"/>

I have a dao class that has a method findAll().

public List<T> findAll() {
return getEntityManager().createQuery("from " + getEntityBeanType().getName() ).getResultList();
}


I then have a test unit that does the following:

for (int i = 0; i <= 5; i++) {
TestTimer timer = new TestTimer("Find All");
awaitedDocs = bean.findAll();
timer.done();
System.out.println("Total Found: " + awaitedDocs.size());
awaitedDocs.clear(); }

after the initial findAll()..... I can see that the cache is populated with the correct data. I see this using the jmx-console and the printDetails method.

But, the performance is exactly the same. I think it is NOT getting the data from the cache, but making another DB call to get the list. There are about 15,000 rows returned. The Initial call takes about 19 seconds, and the rest of the calls take the same amount of time. does this call keep making DB calls, or does it use the cache? Thanks in advance.


Top
 Profile  
 
 Post subject: Solution for caching in JBoss 4.2.2.GA and EJB3
PostPosted: Tue Apr 29, 2008 6:20 am 
Newbie

Joined: Tue Apr 29, 2008 5:50 am
Posts: 1
Hello,
I had the same problem with entity beans and queries in JBoss 4.2.2 that uses Hibernate.
The solution was increasing value 5000 to 50000 for attribute "maxNodes" in configuration file ejb3-entity-cache-service.xml.
So the resulting tag looks like:
...
<attribute name="EvictionPolicyConfig">
<config>
<attribute name="wakeUpIntervalSeconds">5</attribute>
<!-- Cache wide default -->
<region name="/_default_">
<attribute name="maxNodes">50000</attribute>
<attribute name="timeToLiveSeconds">1000</attribute>
</region>
</config>
</attribute>


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