aspose file tools*
The moose likes Object Relational Mapping and the fly likes Toplink Cache coordination using JMS for manual DB updates Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Toplink Cache coordination using JMS for manual DB updates" Watch "Toplink Cache coordination using JMS for manual DB updates" New topic
Author

Toplink Cache coordination using JMS for manual DB updates

allareddy suneel
Greenhorn

Joined: Sep 18, 2012
Posts: 13
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

Joined: Oct 01, 2007
Posts: 553
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.


TopLink : EclipseLink : Book:Java Persistence : Blog:Java Persistence Performance
allareddy suneel
Greenhorn

Joined: Sep 18, 2012
Posts: 13
James,
Thanks for the inputs.
allareddy suneel
Greenhorn

Joined: Sep 18, 2012
Posts: 13
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

Joined: Oct 01, 2007
Posts: 553
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

Joined: Sep 18, 2012
Posts: 13
Thanks James!!! i am able to send message and able to succeed.
 
Don't get me started about those stupid light bulbs.
 
subject: Toplink Cache coordination using JMS for manual DB updates