Link to home
Start Free TrialLog in
Avatar of Squadless
Squadless

asked on

Hibernate error

Hello, im running a java application which works with hibernate
when i compile my code it works fine, but half way through running it, if i hit a certain button i get this error

///:code:///          
Configuration forAlias = configurationForAlias();

Session session = forAlias.buildSessionFactory().openSession();
//the above line fails...give the error below

 [java] Initial Session Factory creation failed org.hibernate.HibernateException: database product name cannot be null
 [java] org.hibernate.HibernateException: database product name cannot be null

What does that mean exactly...i checked my config file, property files, hbm file, and the database supplied is there and is valid...it also gets passed to the function correctly.
Does anyone know what this error on line one means??

Thanks
ASKER CERTIFIED SOLUTION
Avatar of contactkarthi
contactkarthi
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Squadless
Squadless

ASKER

I've tried

Session session = forAlias.configure().buildSessionFactory().openSession();
Session sessionFactory = new Configuration().configure().buildSessionFactory().openSession();

doesnt work...
do you know what the problem is?? i mean why do i get an exception (it does say something abuot database... is somthign not getting set or what)

Thanks
this has something to do with the config.. not sure why it is occuring in one scenario
ok i fixed it, I was doing it in a singleton...apparently its not allowed to be in one...

Thanks for your help