This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Toplink Cache coordination using JMS for manual DB updates

 
allareddy suneel
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We are having 2 web application using same Database and common Toplink library, but 2 different session objects for both the applications. We are using JMS for cache coordination. JMS propagating messages successfully between the applications and able to see the object changes in both the applications properly. Now, we are trying to refresh cache for manual updates in Database.
We are trying to refresh particular object which is modified in database in one application, it is able to refresh in the application from which refresh happened but not in other application. Is there any way we can force JMS to propagate these changes/updates?

Our intention is refreshing in one application so that JMS should coordinate and update in others when DB manual updates. Please let us know any comments for the same.

Database using: Oracle 11g
Toplink Version:- 9.0.3

Also, we are planning to migrate Toplink to eclipse Link soon but i think above issue will be persists.

Please let us know if any more details required on the same.
 
James Sutherland
Ranch Hand
Posts: 553
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In TopLink 9.0.3, there is no API, but you could create and send your own cache coordination message. You would just need to create a change set for the object and send it.

In TopLink 11g (EclipseLink) you can use the JpaCache API evict(Class, Object, boolean) to invalidate an object in the cluster.

See,
http://wiki.eclipse.org/EclipseLink/UserGuide/JPA/Basic_JPA_Development/Caching/Cache_API

The API is also available in the native API on the IdentityMapAccessor.

FYI: TopLink 11g inlcudes EclipseLink, so migrating to EclipseLink is the same as migrating to TopLink 11g.
 
allareddy suneel
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
James,
Thanks for the inputs.
 
allareddy suneel
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
James,
I am trying to prepare JMS message but not able to complete, any sample code/ link i can refer to?
 
James Sutherland
Ranch Hand
Posts: 553
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would not create your own JMS message, but use the session's commandManager (or cacheSynch) to send the message. You just need to give it the UnitOfWorkChangeSet that you will build with the ObjectChangeSet of your changed object.

I would be much easier if you upgrade to 11g.
 
allareddy suneel
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks James!!! i am able to send message and able to succeed.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic