elias
elias

Reputation: 15490

Weblogic + JPA don't refresh data on Oracle database

I have a system based on Oracle10g (datasource) + Weblogic 10.3 + Eclipselink.

If I insert or delete data via the Java software with DAOs, all the data are immediately avaliable, but if I manually insert data (via SqlDeveloper or using the java.sql.Connection class), the new data are not brought from database.
Why it happens? And how to fix it?

Upvotes: 0

Views: 676

Answers (1)

Mikko Maunu
Mikko Maunu

Reputation: 42114

It happens because EclipseLink cannot be aware that changes are made to database via some other methods. External tools do not inform EclipseLink about changes and EclipseLink is not all the time polling database content for possible changes. Such a implementation would kill performance. Same happens also with changes made via JPA bulk operations, like JPQL and native SQL DELETE and INSERT queries.

You cannot really fix the problem, but it is easier to live with it, when you turn of shared cache. Be aware of likely performance hit.

In JPA 1:

<property name="eclipselink.cache.shared.default" value="false"/>  

and in JPA 2:

<shared-cache-mode>NONE</shared-cache-mode>

As an addition of shared cache, also EntityManager maintains cache. Single entity can refreshed from database via refresh method.

Upvotes: 1

Related Questions