views:

47

answers:

1

Hello,

I'm developing a JEE application to run on Glassfish:

  • Database (javaDB, MS SQL, MySQL or Oracle)
  • EJB layer with JPA (Toplink essentials - from Glassfish) for database access
  • JSF/Icefaces based web UI accessing the EJB layer

The application will have a lot of concurrent web client, so I want to run it on different physical servers and use a load-balancer. My problem is now how to keep the applications synchronized. I intend to set up multiple servers, each running Glassfish with my EAR app installed. Whenever on one of the servers data is added to or removed from the database (via JPA, no direct SQL queries), this change should be reflected in the JPA layer on the other servers. I've been looking around for solutions to this, but couldn't find anything I really like (the full Toplink from Oracle claims to have a solution, but don't know). Doing a refresh before every access to a JPA entity could work, but is far from efficient.

Are there any patterns, libraries, ... that could help here?

Thanks a lot!

A: 

Whenever on one of the servers data is added to or removed from the database (via JPA, no direct SQL queries), this change should be reflected in the JPA layer on the other servers.

I don't understand what state is maintained and need to be updated at the "JPA layer". Entity managers are isolated and the way to deal with concurrency in JPA is to use locking (optimistic or pessimistic, the former scaling better). Maybe you could clarify what you need exactly and what you saw.

See also

Pascal Thivent
I guess he means the 2nd level cache, which then need to be distributed.
ewernli
http://old.nabble.com/Distributed-Cache-Setup-td28392760.htmlhttp://weblogs.java.net/blog/guruwons/archive/2006/09/understanding_t.html
sof