What is the contents of your hibernate.properties file (or hibernate.cfg.xml file) and in what directory did yout place it? Also, how did you create/instantiate the SessionFactory?
Regards, David
I used the hibernate.properties file as per the exemple : ===================== hibernate.dialect net.sf.hibernate.dialect.MySQLDialect hibernate.connection.driver_class org.gjt.mm.mysql.Driver hibernate.connection.url jdbc:mysql:///test_hibernate hibernate.connection.username admin hibernate.connection.password ======================== Place the file under WEB-INF/classes
And used file ConnectionFactory.java: ================================== package com.edhand.hibernate1;
import net.sf.hibernate.HibernateException; import net.sf.hibernate.MappingException; import net.sf.hibernate.Session; import net.sf.hibernate.SessionFactory; import net.sf.hibernate.cfg.Configuration;
public class ConnectionFactory {
private static ConnectionFactory instance = null; private SessionFactory sessionFactory = null;
private ConnectionFactory() { try { Configuration cfg = new Configuration().addClass(Item.class);
sessionFactory = cfg.buildSessionFactory(); } catch (MappingException e) { System.err.println("Mapping Exception" + e.getMessage()); throw new RuntimeException(e); } catch (HibernateException e) { System.err.println("Hibernate Exception" + e.getMessage()); throw new RuntimeException(e); }
}
public static synchronized ConnectionFactory getInstance() { if (instance == null) { instance = new ConnectionFactory(); } return instance; }
public Session getSession() { try { Session s = sessionFactory.openSession(); return s; } catch (HibernateException e) { System.err.println("Hibernate Exception" + e.getMessage()); throw new RuntimeException(e); } } } ============================
-- _________________ Mario St-Gelais www.gestionti.com "Good judgment comes from experience- usually experience which was the result of poor judgment" Bill Putnam
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]