Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version: 3.0
Mapping documents: hibernate.properties and Personnes.hbm.xml
Code between sessionFactory.openSession() and session.close():
SessionFactory sessionFactory = config.buildSessionFactory();
Session session = sessionFactory.openSession();
Transaction tx = null;
try {
tx = session.beginTransaction();
Personnes personne = new Personnes("nom3", "prenom3", new Date());
session.save(personne);
session.flush() ;
tx.commit();
} catch (Exception e) {
if (tx != null) {
tx.rollback();
}
throw e;
} finally {
session.close();
}
sessionFactory.close();
Full stack trace of any exception that occurs:
00:44:11,478 INFO Environment:464 - Hibernate 3.0.5
00:44:11,478 INFO Environment:482 - loaded properties from resource hibernate.properties: {hibernate.cglib.use_reflection_optimizer=true, <hibernate-configuration>=, <session-factory>=, <mapping=resource="Personnes.hbm.xml"/>, </session-factory>=, <?xml=version='1.0' encoding='utf-8'?> , </hibernate-configuration>=, "http=//hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">, <!DOCTYPE=hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 2.0//EN", <property=name="show_sql">true</property>}
00:44:11,488 INFO Environment:510 - using CGLIB reflection optimizer
00:44:11,488 INFO Environment:540 - using JDK 1.4 java.sql.Timestamp handling
00:44:11,578 INFO Configuration:464 - Mapping resource: Personnes.hbm.xml
00:44:14,542 INFO HbmBinder:260 - Mapping class: Personnes -> personnes
00:44:14,562 INFO Configuration:875 - processing extends queue
org.hibernate.HibernateException: database product name cannot be null
at org.hibernate.dialect.DialectFactory.determineDialect(DialectFactory.java:57)
at org.hibernate.dialect.DialectFactory.buildDialect(DialectFactory.java:39)
at org.hibernate.cfg.SettingsFactory.determineDialect(SettingsFactory.java:374)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:110)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1463)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1004)
at TestHibernate1.main(TestHibernate1.java:13)
00:44:14,562 INFO Configuration:879 - processing collection mappings
00:44:14,562 INFO Configuration:888 - processing association property references
00:44:14,562 INFO Configuration:917 - processing foreign key constraints
00:44:14,642 WARN UserSuppliedConnectionProvider:23 - No connection properties specified - the user must supply JDBC connections
Exception in thread "main"
Name and version of the database you are using: Oracle 10g
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt:
hi,
i am building a small project,
learning hibernate, so i have my class People.java,
which maps the People table in the database,
I also have TestHibernate1.java, which does the main work,
and I have my 2 configuration files, in the same folder as the 2 previous java files,
hibernate.properties
and
People.hbm.xml
so I added all the needed libraries
and I know get this error: org.hibernate.HibernateException: database product name cannot be null
i now*
you have an idea where the problem might be ?
The database product name cannot be null is being generate when i am calling SessionFactory sessionFactory = config.buildSessionFactory();
In my hibernate.properties, i have dialect set to org.hibernate.dialect.OracleDialect
maybe i should call it hibernate.cfg.xml instead of hibernate.properties ?