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.  [ 2 posts ] 
Author Message
 Post subject: hibernate dialect
PostPosted: Thu Apr 06, 2006 4:07 am 
Newbie

Joined: Mon Mar 27, 2006 10:23 am
Posts: 11
bonjour
je bien configuré la base et je creé ma fichier de mapping pour une seule classe et je saisi le code suivant
package article;

import org.hibernate.*;
import org.hibernate.cfg.*;

public class HibernateUtil {

public static final SessionFactory sessionFactory;

static{
try {

// Create the SessionFactory from hibernate.cfg.xml
System.out.println("debut d'initialisation d'hibernate");
Configuration cfg = new Configuration();
//cfg.addResource("article/Article.hbm.xml");
cfg.addClass(article.Article.class);
cfg.setProperties(System.getProperties());
System.out.println(" fin d'initialisation d'hibernate");
sessionFactory = cfg.buildSessionFactory();
} catch (Throwable ex) {
// Make sure you log the exception, as it might be swallowed
System.err.println("Initial SessionFactory creation failed." + ex);
throw new ExceptionInInitializerError(ex);
}
}
mais j'ai toujours le meme exception :
Initial SessionFactory creation failed.org.hibernate.HibernateException: Hibernate Dialect must be explicitly set
java.lang.ExceptionInInitializerError
at article.HibernateUtil.<clinit>(HibernateUtil.java:30)

Merci
[/i][/b]


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 17, 2006 6:11 pm 
Proxool Developer
Proxool Developer

Joined: Tue Aug 26, 2003 10:42 am
Posts: 373
Location: Belgium
Le cfg.setProperties() est cense transmettre des proprietes specifiques Hibernate et non les proprietes de l'environement comme tu l'as fait.

Je te conseille de relire attentivement la doc concernant la configuration (les premiers chapites) et de jetter un coup d'oeil a la class HibernateUtils que tu trouveras dans l'exemple CaveatEmptor officiel... Tu comprendras rapidemment ce qui ne va pas ;)

(any credit?)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.