I am currently working on a web project where i am using hibernate.cfg.xml. Now i a planning to move all entity model classes to a separate jar and then refer the entites from the external jar. Also I am not using Entity Manager anywhere. Am using SessionFactory so have only included hibernate.cfg.xml file.
Below Hibernate.cfg.file has been placed in WEB-INF->classes folder
<?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>
<!-- Database connection settings -->
<property name="connection.driver_class">org.sqlite.JDBC</property>
<property name="connection.url">jdbc:sqlite:C:\workspace\gsepHelpdeskDB.sqlite</property>
<property name="connection.username"></property>
<property name="connection.password"/>
<property name="hibernate.connection.provider_class">
org.hibernate.c3p0.internal.C3P0ConnectionProvider</property>
<property name="hibernate.c3p0.min_size">1</property>
<property name="hibernate.c3p0.max_size">50</property>
<property name="hibernate.c3p0.timeout">120</property>
<property name="hibernate.c3p0.max_statements">10</property>
<!-- SQL dialect -->
<property name="dialect">com.enigmabridge.hibernate.dialect.SQLiteDialect</property>
<!-- Disable the second-level cache -->
<property name="cache.provider_class">org.hibernate.cache.internal.NoCacheProvider</property>
<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>
<!-- Drop and re-create the database schema on startup -->
<!-- <property name="hbm2ddl.auto">create</property> -->
<!-- Do not Drop, only update the database schema on startup -->
<property name="hbm2ddl.auto">update</property>
<!-- <mapping resource="org.hibernateDemo.dto.UserDetails.hbm.xml"/> -->
<mapping class="com.daimler.gsep.Tool"/>
<mapping class="com.daimler.gsep.RequestorInfo"/>
</session-factory>
</hibernate-configuration>
The entity classes mentioned in mapping tag of hibernate config file are actually placed in a jar named projectAutomationPOJOs.jar. And I have placed the jar in the lib folder. When I am running the application, then I am getting error like "Tool is not mapped".