-->
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: hibernate dialect
PostPosted: Thu Apr 06, 2006 4:08 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: Thu Apr 06, 2006 10:00 am 
Newbie

Joined: Thu Mar 30, 2006 8:23 am
Posts: 19
Location: FRANCE 67
Bonjour,

Pour qu'il charge la configuration du fichier hibernate.cfg.xml où est définit la base de donnée (dialect, driver, login, pwd, etc...) Il faut lancer :

cfg.configure();

sinon tu peut le faire dans HibenrateUtil en tapant :

configuration.setProperty("hibernate.connection.driver_class","<Le driver>");
configuration.setProperty("hibernate.connection.url","<L'URL du jdbc>");
configuration.setProperty("hibernate.connection.username","<Le login>");
configuration.setProperty("hibernate.connection.password","<le mot de passe>");
configuration.setProperty("hibernate.dialect","<Le dialect>");

j'éspère t'avoir aidé
Bonne continuation
_____________________________________________________________
Don't forget to quote me !!!! Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 06, 2006 11:21 am 
Newbie

Joined: Mon Mar 27, 2006 10:23 am
Posts: 11
Merci
ça marche mais il m'affiche une exception


Initialialisation de SessionFactory echouée :
org.hibernate.HibernateException: Could not instantiate cache implementation
java.lang.ExceptionInInitializerError
at article.HibernateUtil.<clinit>(HibernateUtil.java:36)
at article.AddCmd.store(AddCmd.java:33)
at article.Frame1.bAjouterArticle_actionPerformed(Frame1.java:129)
at article.Frame1$Frame1_bAjouterArticle_actionAdapter.actionPerformed(Frame1.java:227)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1786)
at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1839)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 06, 2006 11:49 am 
Newbie

Joined: Thu Mar 30, 2006 8:23 am
Posts: 19
Location: FRANCE 67
ben sans ton Hibernateutil je ne peut pas t aider alors post le et je t aiderais.


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.