-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: org.hibernate. HibernateException: database product name ca
PostPosted: Sat Aug 06, 2005 1:46 am 
Newbie

Joined: Sat Aug 06, 2005 1:38 am
Posts: 4
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 ?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 24, 2005 4:59 am 
Newbie

Joined: Wed May 11, 2005 11:41 pm
Posts: 2
How to resolve this problem?
I encountered it too,but could find the way to resolve it:(

_________________
a newer to hibernate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 24, 2005 5:18 am 
Senior
Senior

Joined: Tue Aug 23, 2005 8:52 am
Posts: 181
It looks like you have a XML file stored as hibernate.properties? can you post the contents of hibernate.properties.

You can do the configuration as a properties file or as a XML file. Please look through the Hibernate Docs to find out more and the format related to these configuration files.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 24, 2005 5:31 am 
Newbie

Joined: Wed May 11, 2005 11:41 pm
Posts: 2
my config file like this

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration
PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>
<session-factory>

<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connetcion.url">jdbc:mysql://127.0.0.1:3306</property>
<property name="connection.username">root</property>
<property name="connection.password">root</property>
<property name="connection.pool_size">3</property>
<property name="connection.dialect">org.hibernate.dialect.MysqlDialect</property>
<!--<property name="bdm2ddl.auto">create</property>-->
<property name="hibernate.show_sql">true</property>
<property name="hibernate.use_outer_join">true</property>
<property name="hibernate.transaction.factory_class">
net.sf.hibernate.transaction.JDBCTransactionFactory
</property>

<mapping resource="Cat.hbm.xml" />
</session-factory>
</hibernate-configuration>


thanks

_________________
a newer to hibernate


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.