It sounds like you didn't configure the primary key generation correctly. I believe that MySQL supports identity keys, not sequences. Your <generator> tag should look like:
<generator type="identity"/> OR <generator type="native"/> Go here for more: http://www.hibernate.org/hib_docs/reference/html/or-mapping.html#or-mapping-s1-4--generator On 2004-Apr-07 22:04, Mario St-Gelais wrote: > David Friedman wrote: > > >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] -- Nick Heudecker System Mobile, Inc. Email: [EMAIL PROTECTED] Web: http://www.systemmobile.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]