Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] EclipseLink cache configuration for Struts plus Spring application

I have looked through a number of the JPA caching posts on the forum but I
haven't found a solution to what my problem is.

My application is a web application running on Tomcat (5.5) and using MySql
as the database.  The web application framework is Struts and the business
layer is managed by Spring.  In this web application most users will be
running queries for data so no transactions will be going on and I would
like speed for these tasks.  Data entry will be going on from time to time
by some administrator screens where new data is entered and/or existing data
updated.

The application is performing pretty well so far (half-way through
development).  The problem I am having is I am seeing a caching problem(?)
when new data is entered through the admin screen followed by a user finding
the data in a query.

So an admin user enters several new records.  Then an application user
executes a search where the new data is included in the result set.  When
the result page attempts to display attributes of the search result data I
am seeing some errors due to the newly entered records having nulls for some
their attributes.  The missing data is in the database but is just not being
returned with the search results.  

Is this more of a fetch strategy problem?  The missing attribute data will
show up if I use a screen that specifically finds and returns the individual
record.   After that the searches then also return all of the attributes. 
Or is this a problem with my cache settings?  I have tried setting the
caching in the persistence.xml with and without the entry -
<property name="eclipselink.cache.shared.default" value="false"/>
and I don't see any difference in performance or my error.

One other thing about the search not immediately seeing all of the entity
attributes - If I reboot my server or redeploy my application the search
will find all of the data it needs.  It is only immediately after the new
entity is created in the database that the JPA search query is not finding
the data.

My search queries performing the search are both queries like -

Query q = em.createQuery(qSB.toString());
List<MyEntity> eList = q.getResultList();

and 

ReadAllQuery readAllQuery = new ReadAllQuery(MyEntity.class);
....set variables...
javax.persistence.Query jpaquery = ((JpaEntityManager)
em.getDelegate()).createQuery(readAllQuery);
...set variables....
List<MyEntity> results = jpaquery.getResultList();

Thanks for any help with a good solution to provide fast searches yet be
able to sync with new entity additions.

-sonavor

-- 
View this message in context: http://www.nabble.com/EclipseLink-cache-configuration-for-Struts-plus-Spring-application-tp25628655p25628655.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top