Dear all,
I have a derby database application which works well in netbeans IDE. It uses network driver, and hibernate. I have deployed the application and it can work when I keep netbeans open, but once netbeans is closed, the application jar file stop working. I have read many related posts, it seems I need to use embedded driver. then I created an embedded database which is exactly same as the the network database I used before, and I revised the hibernate.cfg.xml correspondingly, but I got error
"SEVERE: Table/View 'MODELS' does not exist." (here 'MODELS' is the table in the embedded database, which does exist. I can see it in the Services tab. )
the hibernate.cfg.xml I use is :
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<!-- Database connection settings -->
<property name="connection.driver_class">org.apache.derby.jd bc.EmbeddedDriver</property>
<property name="connection.url">jdbc:derby:derbyDBIFM</property>
<property name="connection.username">app</property>
<property name="connection.password">app</property>
<!-- JDBC connection pool (use the built-in) -->
<property name="connection.pool_size">1</property>
<!-- SQL dialect -->
<property name="dialect">org.hibernate.dialect.DerbyDialect</property>
<!-- Echo all executed SQL to stdout -->
<property name="show_sql">false</property>
<!-- Mapping files -->
<mapping resource="modelvisulisationtest/model/model.hbm.xml"/>
</session-factory>
</hibernate-configuration>
the function I use to get data from the database is as follows:
private static ArrayList<ModelData> read() {
SessionFactory sessions = new Configuration().configure("/modelvisulisationtest/model/hibernate.cfg.xml").buildSessionFactory();
Session session = sessions.openSession();
ArrayList<ModelData> result = new ArrayList<ModelData>();
.....
}
Untitled.jpg
any idea how I can fix it? thanks in advance.
Jenny