mardi 29 mars 2016

sqlite path in hibernate.cfg.xml on glassfish server

I'm trying to use sqlite using hibernate. However, I've had hard time, configuring sqlite database path. Currently, my hibernate.cfg.xml looks like this:

<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
        "-//Hibernate/Hibernate Configuration DTD//EN"
        "http://ift.tt/1fnOghG">
<hibernate-configuration>
    <session-factory>
        <property name="connection.url">jdbc:sqlite:test.db</property>
        <property name="connection.driver_class">org.sqlite.JDBC</property>
        <property name="hibernate.dialect">org.hibernate.dialect.SQLiteDialect</property>
        <property name="current_session_context_class">thread</property>

        <mapping class="com.test.entity.Category"/>
        <!-- DB schema will be updated if needed -->
        <!-- <property name="hbm2ddl.auto">update</property> -->
    </session-factory>
</hibernate-configuration>

I'm using IntelliJ. I've placed test.db in resources & in the artifacts I could see it in classes package. However, everytime I get this error:

org.hibernate.hql.internal.ast.QuerySyntaxException: Category is not mapped [select id from Category]

I've checked sessionFactory.getAllClassMetadata() - it shows no class mapped. Any help would be greatly appreciated.

Aucun commentaire:

Enregistrer un commentaire