Win a copy of Spark in Action this week in the Open Source Projects forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Cons of cache-between-transactions

 
Ranch Hand
Posts: 136
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I could not understand the restrictions and warnings of cache-between-transactions in the ebj.pdf from bea.
Can anyone put some light on it?
thanx
faiza
 
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Setting cache-between-transactions causes the server to NOT call ejbLoad at the beginning of each transaction. Instead, it remembers the cached data from the last time the bean was used. It uses cache rather than fetching current view from the database every time. This can help performance, but you have to be careful.
When you set cache-between-transactions, you are telling the server that you know its cache will always contain good data.
If you have multiple things accessing the database, you can not know this.
For example if you have a cluster (several servers accessing the database) or maybe the database is accessed by both WLS/EJB and some old VisualBasic application.
In these cases, the servers cache might not be up to date, so you can't use cache-between-transactions without risking bad data. In these cases you must use the default behavior where ejbLoad is called for each transaction.
 
faiza athar
Ranch Hand
Posts: 136
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanx Dave!
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Dave Landers:
... For example if you have a cluster (several servers accessing the database) ...


To cache in a cluster, check out Coherence:
http://www.tangosol.com/coherence.jsp
Peace,
Cameron Purdy
 
What kind of corn soldier are you? And don't say "kernel" - that's only for this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic