Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SessionFactory and database product name Error

 
david allen
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I am new to Hibernate and am trying to set it up with tomcat and Mysql.

The database product name cannot be null is being generate when i am calling
SessionFactory factory = Configuration().setProperties(System.getProperties()).buildSessionFactory();

In my hibernate.cfg.xml i have dialect set to "org.hibernate.MySQLDialect"

Any help appreciated
 
miguel lisboa
Ranch Hand
Posts: 1281
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
just a guess:
you also need:
<property name = "hibernate.dialect">net.sf.hibernate.dialect.MySQLDialect</property>
<property name = "hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name = "hibernate.connection.url">jdbc:mysql://localhost/xxx</property>
<property name = "hibernate.connection.username">xxx</property>
<property name = "hibernate.connection.password">xxx</property>
 
david allen
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for the reply but I have included those properties as well.

Any other ideas

Thank you

David
 
Ryan Chiu
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, hope this will help ...
I had tried http://www.onjava.com/lpt/a/4386 online sample, and I got "database product name cannot be null", but I tried to rename my hibernate.properties to hibernate.properties.old, I still got this error message, so I guess maybe hibernate cann't find hibernate.properties. And then I move hibernate.properties to /src/hibernate.properties, and everything is ok. So maybe you should try to put hibernate.properties the right folder.
Sorry, I am not advanced user, but I try to help.

Ryan
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic