I tried an exemple application Struts and Hibernate
net.sf.hibernate.MappingException : Dialect does not support
identity key generation.
I run Tomcat 5.0.19 . MySQL, Struts 1.1.
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://localhost:3360/<databasename>
hibernate.connection.username =
hibernate.connection.password =
========================================================
Place the file under WEB-INF/classes
And used file ConnectionFactory.java:
====================== ==================================
package com.edhand.example1;
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);
}
}
}
============================ ============================
Any help would be graceful.
S.P.Raghuwanshi

