Hi, im getting this error in my code: Initial Session Factory creation failed org.hibernate.HibernateException: database product name cannot be null org. hibernate.HibernateException: database product name cannot be null at org.hibernate.dialect.DialectFactory.determineDialect(DialectFactory.java:57)
an so fourth...
The line which produces that exception is here:
Configuration forAlias = configurationForAlias(); //works fine Session session = forAlias.buildSessionFactory().openSession();//throws exception I've tried the following but they do not help: Session session = forAlias.configure().buildSessionFactory() .openSession(); Session sessionFactory = new Configuration().configure().buildSessionFactory().openSession();
Does anyone have an idea WHAT the problem is...not necessarily how to fix it but exactly why does it say "database product cannot be null"?? (properties,configuration files are correct and spit out correct results); Thanks, Alex
OK that is the correct dialect, there might be some other problem above it in your XML, like a missed closed tag or something like that.
But, also I noticed that you are trying to create a Session at the same time as creating a SessionFactory, these two things should be done seperately, as creating a SessionFactory is heavy-weight. So using a Singleton SessionFactory is the way to go, then just get that singleton and open Sessions from there. Opening sessions are lightweight. And it is ok if you do that often, rather than always creating new SessionFactories.
Alex, please post your hibernate.xml.cfg. There is a CODE button below the Add Reply button, make sure you put your xml within CODE tags so that your indentation will remain in your post, and make it easier for us to read.
I want to see if we can spot the problem. I have some guesses. 1) the version of Hibernate you are using versus the package of the Dialect classes. 2) Some single character error somewhere in your HTML.
Basically the code in Hibernate that has the error was first getting a String value from a Properties object passed to the method. These are Properties that are set in the hibernate.xml.cfg
So if that is null, then it tries to find the Dialect another way which is also failing, but I don't think that the dialectName var should be null.
subject: org.hibernate. HibernateException: database product name cannot be null