Note that there are some explanatory texts on larger screens.

plurals
  1. PODialect not getting set in hibernate
    primarykey
    data
    text
    <p>I am using Hibernate 3 and MySQL5.5.</p> <p>I am a newbie to hibernate and I am getting the below Exception</p> <pre><code>Exception in thread "main" org.hibernate.HibernateException: 'hibernate.dialect' must be set when no Connection available at org.hibernate.dialect.resolver.DialectFactory.buildDialect(DialectFactory.java:106) at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:152) </code></pre> <p>I have set the Dialect property in hibernate.cfg.xml file. I tried a lot of combinations </p> <pre><code>&lt;property name="hibernate.dialect"&gt;org.hibernate.dialect.MySQL5Dialect&lt;/property&gt; &lt;property name="dialect"&gt;org.hibernate.dialect.MySQL5Dialect&lt;/property&gt; &lt;property name="DIALECT"&gt;org.hibernate.dialect.MySQL5Dialect&lt;/property&gt; </code></pre> <p>What is the actual property name ? Hibernate.dialect or only dialect ? What can be possible property values ?</p> <p>I am adding some more information, I used </p> <pre><code>&lt;property name="hibernate.dialect"&gt;org.hibernate.dialect.MySQLDialect&lt;/property&gt; </code></pre> <p>as suggested by below answers.</p> <p>I am not even building any code just trying to create simple configuration:</p> <pre><code>Configuration cfg = new Configuration().addClass(Employee.class); sessionFactory = cfg.buildSessionFactory(); </code></pre> <p>Below is the actual Configuration file</p> <pre><code>&lt;?xml version='1.0' encoding='utf-8'?&gt; &lt;!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"&gt; &lt;hibernate-configuration&gt; &lt;session-factory&gt; &lt;property name="hibernate.dialect"&gt;org.hibernate.dialect.MySQLDialect&lt;/property&gt; &lt;property name="connection.url"&gt;jdbc:mysql://localhost/test&lt;/property&gt; &lt;property name="connection.username"&gt;root&lt;/property&gt; &lt;property name="connection.password"&gt;root1234&lt;/property&gt; &lt;property name="connection.driver_class"&gt;com.mysql.jdbc.Driver&lt;/property&gt; &lt;property name="show_sql"&gt;true&lt;/property&gt; &lt;property name="format_sql"&gt;true&lt;/property&gt; &lt;property name="hbm2ddl.auto"&gt;create&lt;/property&gt; &lt;!-- JDBC connection pool (use the built-in) --&gt; &lt;property name="connection.pool_size"&gt;1&lt;/property&gt; &lt;property name="current_session_context_class"&gt;thread&lt;/property&gt; &lt;!-- Mapping files will go here.... --&gt; &lt;/session-factory&gt; &lt;/hibernate-configuration&gt; </code></pre> <p>I suspect the hibernate.cfg.xml is not being found ? I have placed it in the same package where the source code for Employee.class is there. Infact moving around this file causes the same error, so it is not actually found :-( Where to keep it ? This is a standalone Test program :-(</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload