我必须在Netbeans中开发一个WAR-Application。作为Web服务器,我使用内置的Jetty来测试WAR,因为发布版本也应该使用Jetty。 在Netbeans中,我有一个设置来在保存文件后重新部署WAR。
我遇到的问题是,在重新部署(第一次部署工作正常)再次连接到Firebird数据库后,应用程序将在第一个输出处停止:
Hibernate: create table HT_mytable (myid numeric(18,0) not null, hib_sess_id CHAR(36))
这是我创建EntityManager的代码
protected EntityManager createEntityManager(String databaseName) {
String user = this.settingsService.getValue("user", "database");
String password = this.settingsService.getValue("password", "database");
Properties properties = new Properties();
properties.put("hibernate.show_sql", true);
properties.put("javax.persistence.jdbc.url", this.createUrlForDatabase(databaseName));
properties.put("javax.persistence.jdbc.user", user);
properties.put("javax.persistence.jdbc.password", password);
properties.put("javax.persistence.jdbc.driver", "org.firebirdsql.jdbc.FBDriver");
try {
EntityManagerFactory emf = Persistence.createEntityManagerFactory(UNITNAME_PREFIX + databaseName, properties);
return emf.createEntityManager();
} catch(PersistenceException ex) {
Logger.getLogger(EntityService.class.getName()).log(Level.SEVERE, null, ex);
}
return null;
}
谢谢:)