Hi,
I am using Hibernate 2.1.2 with MySQL 4.1 on Resin 2.1.12. This is my first attempt at using Hibernate with MySQL and I have done pretty much the same things that I did with my previous implementation on SAPDB.
Code:
<property name="hibernate.connection.datasource">java:comp/env/hibernate/mysql/test</property>
<property name="dialect">net.sf.hibernate.dialect.MySQLDialect</property>
<property name="show_sql">true</property>
<property name="transaction.factory_class">net.sf.hibernate.transaction.JDBCTransactionFactory</property>
<property name="hibernate.cache.provider_class">net.sf.hibernate.cache.HashtableCacheProvider</property>
<property name="hibernate.cglib.use_reflection_optimizer"> false</property>
It is using a Resin connection pool which works fine when using straight JDBC to get data from the DB.
Here is the code in my HibernateManager class.
Code:
static
{
try
{
/**
* File name need not be specified here. By default hibernate.cfg.xml is
* chosen. However, if the file name is changed in the application, it
* will need to be modified here
*/
logger.debug("loading session factory.");
sessionFactory = new Configuration().configure().buildSessionFactory();
logger.debug("Successfully created sessionFactory");
}
catch (HibernateException e)
{
logger.error("HibernateException building SessionFactory: " + Utilities.getStackTrace(e));
throw new RuntimeException("HibernateException building SessionFactory: " + Utilities.getStackTrace(e), e);
}
}
The problem I have is that while the first logger gets written out, it never gets to the second logger and I don't get a HibernateException thrown.
I have the the following setup in my Log4J file but I am not getting any log entries which leads me to believe that Hibernate isn't getting initialized.
log4j.logger.net.sf.hibernate=DEBUG
Obviously, I am doing something really stupid and basic and even though I have been trying to figure it out the entire day I have had no success. Any help is greatly appreciated.
TIA