Last active
August 27, 2021 14:16
-
-
Save jyeary/cccf97050bcdc8a95527aededa978f03 to your computer and use it in GitHub Desktop.
Jakarta EE 8, JPA 3.0, Hibernate 5, and SQLite persistence.xml
This file contains hidden or 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
<?xml version="1.0" encoding="UTF-8"?> | |
<persistence xmlns="https://jakarta.ee/xml/ns/persistence" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="https://jakarta.ee/xml/ns/persistence https://jakarta.ee/xml/ns/persistence/persistence_3_0.xsd" | |
version="3.0"> | |
<persistence-unit name="sqlitePU" transaction-type="RESOURCE_LOCAL"> | |
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider> | |
<exclude-unlisted-classes>false</exclude-unlisted-classes> | |
<properties> | |
<property name="jakarta.persistence.jdbc.url" value="jdbc:sqlite:memory"/> | |
<!-- GlassFish and Payara deployed applications --> | |
<!--<property name="jakarta.persistence.jdbc.url" value="jdbc:sqlite:${com.sun.aas.instanceRoot}/applications/APPLICATION_NAME/WEB-INF/sqlite.db"/>--> | |
<property name="jakarta.persistence.jdbc.driver" value="org.sqlite.JDBC"/> | |
<property name="jakarta.persistence.jdbc.user" value=""/> | |
<property name="jakarta.persistence.jdbc.password" value=""/> | |
<!-- Hibernate --> | |
<property name="hibernate.dialect" value="org.sqlite.hibernate.dialect.SQLiteDialect" /> | |
<property name="hibernate.show_sql" value="true" /> | |
<property name="format_sql" value="true" /> | |
<property name="hibernate.connection.charSet" value="UTF-8" /> | |
<property name="hibernate.hbm2ddl.auto" value="create" /> | |
</properties> | |
</persistence-unit> | |
</persistence> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This requires Jakarta JPA 3.0, Hibernate 5, and a SQLite dialect as noted in dependencies below: