Issue
i am a java student and i have to do a small project. I have to use Maven and Hibernate ( no Spring frameworks). I use IntelliJ as IDE. The thing is that my teacher recomended me to use SQLite as RDBMS because its very simple, 1 file and there is no need to implement a server inside my app. ( i have no idea to do the last point). The problem is that when i try to do the "hibernate.cfg.xml " i have no way to configure it because of the lack of information. Seems there is no dialect supported from Hibernate and the info i could find on internet is outdated. Any idea on how i can configure it? Do i really need to use another RDBMS ? there is a picture of my project structure
this is my hibernate.cfg.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="connection.driver_class">org.sqlite.JDBC</property>
<property name="connection.url">jdbc:sqlite://db/appiculturedb.sqlite3</property>
<property name="connection.username"></property>
<property name="connection.password"></property>
<property name="dialect">org.hibernate.dialect.SQLiteDialect</property>
<property name="hibernate.show_sql">true</property>
<!-- maping with xml-->
<mapping resource="Bodega.hbm.xml" />
<!-- maping with anotations-->
<!-- <mapping class="com.stephane.Bodega" /> -->
</session-factory>
</hibernate-configuration>
Solution
After searching for few days, i found that you can use SQLite with Hibernate 5 if you create your own dialect. You also can try to use someone else dialect wich may be risky or outdated. Check this link for more info. For the moment, hibernate do not support oficially SQLite. Maybe in the future that will change. If you are searching for an embedded database, you can use H2 wich is supported by Hibernate and seems to be recommended by them. You also have HSQLDB or Apache Derby.
Answered By - Osolemio44
Answer Checked By - Cary Denson (JavaFixing Admin)