Last active
November 21, 2022 05:54
-
-
Save rafaeltuelho/e770d79521971138b756 to your computer and use it in GitHub Desktop.
Some Hibernate properties to use in your JPA persistence.xml descriptor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Hibenate JPA Provider --> | |
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" /> | |
<property name="hibernate.hbm2ddl.auto" value="create-drop" /> | |
<property name="hibernate.show_sql" value="true" /> | |
<property name="hibernate.format_sql" value="true" /> | |
<property name="hibernate.use_sql_coments" value="true" /> | |
<property name="hibernate.generate_statistics" value="true" /> | |
<!-- Infinispan --> | |
<property name="hibernate.cache.infinispan.statistics" value="true" /> | |
<property name="hibernate.cache.use_structured_entries" value="true" /> | |
<!-- 2LC --> | |
<property name="hibernate.cache.use_second_level_cache" value="true" /> | |
<property name="hibernate.cache.use_query_cache" value="true" /> | |
<!-- Hibenate Search (Apache Lucene) --> | |
<!-- property name="hibernate.search.default.directory_provider" value="filesystem" /--> | |
<property name="hibernate.search.default.directory_provider" value="infinispan" /> | |
<property name="hibernate.search.default.worker.backend" value="jgroups" /> | |
<property name="hibernate.search.default.indexBase" value="/tmp/lucene/index" /> | |
<shared-cache-mode>ENABLE_SELECTIVE</shared-cache-mode> |
To test JPA entities with Hibernate 2LC using Infinispan add
@Cacheable
to the entities.
To view JPA Persistence Unit runtime statistics use the following JBoss CLI commands:
/deployment=jboss-kitchensink.war/subsystem=jpa/hibernate-persistence-unit=jboss-kitchensink.war#primary/:read-resource(include-runtime=true)
To clean/flush the 2LC use the following JBoss CLI commands
/deployment=jboss-kitchensink.war/subsystem=jpa/hibernate-persistence-unit=jboss-kitchensink.war#primary:evict-all
Hibernate 5.2 configuration properties:
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The list of all possible Hibernate properties can be found in the Hibernate Core manual (Configuration section): http://docs.jboss.org/hibernate/orm/4.3/manual/en-US/html/ch03.html
The Infinispan JPA-Hibernate Second Level Cache Provider: http://infinispan.org/docs/5.3.x/user_guide/user_guide.html#_using_infinispan_as_jpa_hibernate_second_level_cache_provider