I use an HibernateUtil class, and I was loading configuration from an XML configuration file. It seems that it's better to use something like that :
Code:
...
Properties propsSupport = new Properties();
propsSupport.setProperty("hibernate.connection.datasource", java:comp/env/jdbc/support");
propsSupport.setProperty("hibernate.show_sql", "false");
propsSupport.setProperty("hibernate.dialect", net.sf.hibernate.dialect.SQLServerDialect");
propsSupport.setProperty("hibernate.jdbc.batch_size", "10");
Configuration cfgSupport = new Configuration()
.addClass(mypackage.SupportClient.class)
.addClass(mypackage.TypeSupport.class)
.addClass(mypackage.FichierClient.class)
.addClass(mypackage.CommandeClient.class)
.setProperties(propsSupport);
sessionFactorySupport =cfgSupport.buildSessionFactory();
...
by using this way of configuration, duplicate import error has disappeared. Before I used something like that :
Code:
...
URL configFileURLWorkplan = HibernateUtil.class.getResource("hibernateSupport.cfg.xml");
sessionFactoryWorkplan = new Configuration().configure(configFileURLSupport).buildSessionFactory();
...