JPA2.0 support of custom user-types and second level cache

╄→гoц情女王★ 提交于 2019-12-01 17:49:38

问题


I'm trying to decide whether to switch from having Hibernate sprinkled all over to using JPA2.0 and thus be provider portable.
1.Does JPA2.0 support custom user-types?
2.I'm on the verge of implementing Terracotta as a second-level cache to Hibernate with its clustering abilities mainly in mind. I would imagine, but I don't actually know, that JPA2.0 also defines a spec for second-level cache providers. If I'm right, does Terracotta implement it? (If someone could point me to a getting started with Terracotta and JPA I'd appreciate it).

Thanks in advance,
Ittai


回答1:


Does JPA2.0 support custom user-types?

Nothing beyond @Embedded and @Embeddable (already in JPA 1.0). Depending on the complexity of your needs, they might do the job).

I would imagine, but I don't actually know, that JPA2.0 also defines a spec for second-level cache providers.

JPA 2.0 defines methods on the EntityManager to access the second level cache that is maintained by the persistence provider, a Cacheable annotation, some other things. But the way to plug a cache on your JPA provider is provider specific. So no, JPA doesn't define a spec for L2 cache providers. And if you want to use Terracota as the L2 cache provider with Hibernate as JPA 2.0 implementation, look at the Hibernate integration documentation.

References

  • JPA 2.0 specification
    • Section 3.7 "Caching"
    • Section 7.10 "Cache Interface"
    • Section 11.1.7 "Cacheable Annotation"


来源:https://stackoverflow.com/questions/3628344/jpa2-0-support-of-custom-user-types-and-second-level-cache

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!