2
I would like to totally disable the JPA/Eclipselink cache, but I’m not getting it.
I can disable the first level cache using:
query.setHint("javax.persistence.cache.storeMode", CacheStoreMode.REFRESH)
But the second level cache is not disabled.
What should I do to make sure the subtables (@Manytoone) are searched directly from the BD without using cache?
Persistence.xml
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
<persistence-unit name="br.com.empresa_Sistema_war_1.0-SNAPSHOTPU" transaction-type="JTA">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<jta-data-source>jdbc/sistema</jta-data-source>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<shared-cache-mode>NONE</shared-cache-mode>
<properties>
<property name="eclipselink.cache.shared.default" value="false"/>
<property name="eclipselink.query-results-cache" value="false"/>
<property name="eclipselink.refresh" value="true"/>
<property name="eclipselink.logging.level" value="FINE"/>
</properties>
</persistence-unit>
</persistence>
Tried to use
@Cacheable(false)
?– Fellipe Soares
It would be nice to also take a look at documenting.
– Fellipe Soares
@Felipesoares, I added
@Cacheable(false)
in the main and secondary entity class, but it did not work. Keeps showing updated only the main entity information, the secondary updates in the BD, but in the queries appears unchanged.– mwramos