EL missaoui habib
EL missaoui habib

Reputation: 1075

JPA2 cache or hibernate cache

I like to create a new project the integration tier based on hibernate and JPA 2 , i need to use persistance cache .

What's the difference between jpa2 cache and hibernate cache ?

what's the advantage and disadvantages of each cache ?

Upvotes: 1

Views: 192

Answers (1)

Ilya Dyoshin
Ilya Dyoshin

Reputation: 4624

actually JPA2 is specification and Hibernate is implementation of this specification.

None of them provides cache implementation, except session cache (your entities within single transaction/session interaction)

If you plan to add possibility to replace hibernate, then use pure JPA2 annotations and configurations.

Hibernate's annotation @Cache provides a bit more fine grained control on how entities are stored in cache, JPA's @Cacheable provides only possibility either to include in cache or not (all the control of storage in cache is defined in the general JPA configuration and caching implementation).

Upvotes: 3

Related Questions