Problems with dialect SQLite 3 with Hibernate 5
I am using SQLite 3.10 with Hibernate 5.2 with the following configuration:
pom.xml:
<!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-core --><dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-core</artifactId> <version>5.2.12.Final</version></dependency><!-- https://mvnrepository.com/artifact/org.xerial/sqlite-jdbc --><dependency> <groupId>org.xerial</groupId> <artifactId>sqlite-jdbc</artifactId> <version>3.20.1</version> <scope>test</scope></dependency><!-- https://mvnrepository.com/artifact/com.zsoltfabok/sqlite-dialect --><dependency> <groupId>com.zsoltfabok</groupId> <artifactId>sqlite-dialect</artifactId> <version>1.0</version></dependency>
persistence.xml:
<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="first_test" transaction-type="RESOURCE_LOCAL"> <properties> <property name="hibernate.archive.autodetection" value="class" /> <property name="hibernate.dialect" value="org.hibernate.dialect.SQLiteDialect" /> <property name="hibernate.connection.driver_class" value="org.sqlite.JDBC" /> <property name="hibernate.connection.username" value="" /> <property name="hibernate.connection.password" value="" /> <property name="hibernate.connection.user" value="" /> <property name="hibernate.connection.autocommit" value="true"/> <property name="hibernate.connection.url" value="jdbc:sqlite:sqlite.db"/> <property name="hibernate.show_sql" value="true"/> <property name="hibernate.flushMode" value="ALWAYS" /> <property name="hibernate.cache.use_second_level_cache" value="false" /> <property name="hibernate.cache.provider_class" value="org.hibernate.cache.NoCacheProvider" /> <!-- create https://docs.jboss.org/hibernate/orm/5.0/manual/en-US/html/ch03.html --> <property name="hibernate.hbm2ddl.auto" value="validate or create" /> </properties> </persistence-unit></persistence>
Of course you have to change the value of hibernate.connection.url
and hibernate.hbm2ddl.auto
and maybe other properties to your needs.