-->
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 must be explicitly set
PostPosted: Sun Jan 30, 2011 8:22 am 
Beginner
Beginner

Joined: Sun Jan 30, 2011 8:14 am
Posts: 24
Hi guys,
I'm new of Hibernate, please help me to understand my issue...I found other solution on forum, but they didn't help me.
I developed a Javafx application that should interact with derby database via hibernate.
When I run application, at first query time this exception:

Code:
AVVERTENZA: No connection properties specified - the user must supply JDBC connections
Initial SessionFactory creation failed.org.hibernate.HibernateException: Hibernate Dialect must be explicitly set


This is my hibernate.cfg.xml

Code:
<hibernate-configuration>
    <session-factory>
        <property name="hibernate.dialect">org.hibernate.dialect.DerbyDialect</property>
        <property name="hibernate.connection.driver_class">org.apache.derby.jdbc.ClientDriver</property>
        <property name="hibernate.connection.url">jdbc:derby://localhost:1527/dbname</property>
        <property name="hibernate.connection.username">root</property>
        <property name="show_sql">true</property>
        <property name="hibernate.transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property>
        <mapping resource="application/entity/Paziente.hbm.xml"/>
    </session-factory>
</hibernate-configuration>


this is my HibernateUtil

Code:
try {
            sessionFactory = new AnnotationConfiguration().addFile("D:\\testApp\\src\\application\\hibernate\\hibernate.cfg.xml").buildSessionFactory();

        } catch (Throwable ex) {
            // Log the exception.
            System.err.println("Initial SessionFactory creation failed." + ex);
            throw new ExceptionInInitializerError(ex);
        }


and this is my package organization
Code:
application
application.dao
application.entity
   Paziente.hbm.xml
   Paziente.java
application.hibernate
   HibernateUtil.java
   hibernate.cfg.xml
   hibernate.revenge.xml
application.res


I'm using hibernate 3, derby database and netbeans.

Thanks,
Regards


Top
 Profile  
 
 Post subject: Re: Hibernate Dialect must be explicitly set
PostPosted: Sun Jan 30, 2011 8:36 am 
Newbie

Joined: Sun May 09, 2010 4:48 am
Posts: 11
Did you try this...?
sessionFactory = new AnnotationConfiguration().configure("D:\\testApp\\src\\application\\hibernate\\hibernate.cfg.xml").buildSessionFactory();


Top
 Profile  
 
 Post subject: Re: Hibernate Dialect must be explicitly set
PostPosted: Sun Jan 30, 2011 1:58 pm 
Beginner
Beginner

Joined: Sun Jan 30, 2011 8:14 am
Posts: 24
thanks for your reply...
I tried it but unsuccessfully.

NOw I've this exception

Initial SessionFactory creation failed.org.hibernate.HibernateException: D:\\testApp\\src\\application\hibernate\hibernate.cfg.xml not found
Exception in thread "AWT-EventQueue-0" java.lang.ExceptionInInitializerError

it's strange, cause at this path file is present...
could someone help me?
Thanks


Top
 Profile  
 
 Post subject: Re: Hibernate Dialect must be explicitly set
PostPosted: Sun Jan 30, 2011 6:38 pm 
Beginner
Beginner

Joined: Sun Jan 30, 2011 8:14 am
Posts: 24
solved...just put configuration file at root of classpath and I solved.
Thanks for your help


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.