Skip to main content



      Home
Home » Eclipse Projects » EclipseLink » Shared Cache not working when using eclipselink with Spring
Shared Cache not working when using eclipselink with Spring [message #639281] Mon, 15 November 2010 16:48 Go to next message
Eclipse UserFriend
According to this page http://wiki.eclipse.org/EclipseLink/Examples/JPA/JPASpring#C ommon_Issues, and a few tests I ran, you cannot Shared Cache when using EclipseLink with Spring. Is this true?
Are there any workarounds?

# Spring forces the database transaction to begin with the JPA transaction, this will cause objects read in a transaction to not be cached in EclipseLink's shared cache.

[Updated on: Mon, 15 November 2010 17:24] by Moderator

Re: Shared Cache not working when using eclipselink with Spring [message #639973 is a reply to message #639281] Thu, 18 November 2010 10:22 Go to previous messageGo to next message
Eclipse UserFriend
This is true.

There is a setLazyDatabaseTransaction() method on the Spring EclipseLinkJpaDialect. You can set this to false to avoid this issue, you should be able to configure this in your Spring config. Or you could create you own EclipseLink dialect and remove the beginTransaction() method.

I logged a bug for this in Spring here,
https://jira.springframework.org/browse/SPR-7753

There is also an EclipseLink bug that you can vote for,
https://bugs.eclipse.org/bugs/show_bug.cgi?id=288383
Re: Shared Cache not working when using eclipselink with Spring [message #642340 is a reply to message #639973] Tue, 30 November 2010 15:42 Go to previous messageGo to next message
Eclipse UserFriend
I tried setting the lazyDatabaseTransaction to true and adding setting eclipselink.jdbc.exclusive-connection.mode to Always but neither had any effect. Objects are still not getting cached! Is there anything else I can try? How can verify if Eclipselink is being forced to use a transactional connection?
Re: Shared Cache not working when using eclipselink with Spring [message #642791 is a reply to message #639281] Thu, 02 December 2010 12:02 Go to previous message
Eclipse UserFriend
Setting the lazyDatabaseTransaction to true should work. Otherwise yo may need to customize your dialect in Spring.

You can check if the uow is isolated to the transaction by getting the unit of work from the EntityManager and checking,
wasTransactionBegunPrematurely()

Technically you could also switch this calling
setWasTransactionBegunPrematurely(false)
but probably better to fix it in Spring.
Previous Topic:Multiple TableGenerators per Entity
Next Topic:No Cache Synchronization after em.clear?
Goto Forum:
  


Current Time: Tue Jul 22 14:21:45 EDT 2025

Powered by FUDForum. Page generated in 0.04661 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top