hatem sfaxi
hatem sfaxi

Reputation: 1

JPA hibernate persistence pb

I have two server applications with the same database.

I created the persistence for each application. They connect to the same database.

The problem is that the application 1 cannot see the data that's committed by application 2 sometimes (in the query (em.createQuery)).

I found a solution for this problem by closing and reopening the EntityManager before creating the query.

Is there an easier solution in JPA?

Upvotes: 0

Views: 111

Answers (1)

Christian Kuetbach
Christian Kuetbach

Reputation: 16060

If you have a second-level cache enabled and one em can't see the cached data of the second em

solutions:

  1. deactivate the second-level cache
  2. use a network cache with replication
  3. use a single EJB-application as db-layer and use Beans to communicate with your DB

Upvotes: 1

Related Questions