Hi,
My hibernate mapping works when I configure it with an "hibernate.properties".
I would like to make it work with an "hibernate.cfg.xml" file.
Here is my configuration file :
Code:
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="query.substitutions">true 1, false 0, yes 'Y', no 'N'</property>
<property name="dialect">net.sf.hibernate.dialect.MySQLDialect</property>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.url">jdbc:mysql://localhost/proyecto</property>
<property name="connection.username"></property>
<property name="connection.password"></property>
<property name="connection.pool_size">1</property>
<property name="statement_cache.size">25</property>
<property name="proxool.pool_alias">pool1</property>
<property name="hibernate.show_sql">true</property>
<property name="jdbc.batch_size">0</property>
<property name="jdbc.use_streams_for_binary">true</property>
<mapping resource="com/logis/proyecto/persistence/Persistent1.hbm.xml"/>
<mapping resource="com/logis/proyecto/persistence/Persistent2.hbm.xml"/>
</session-factory>
</hibernate-configuration>
When I execute the following piece of code :
Code:
sessionFactory = new Configuration().configure().buildSessionFactory();
Configuration cfg = new Configuration();
new SchemaExport(cfg).create(true, true);
All the properties are set except the dialect.
I get the following error message :
Quote:
net.sf.hibernate.HibernateException: The dialect was not set. Set the property hibernate.dialect.
at net.sf.hibernate.dialect.Dialect.getDialect(Dialect.java:273)
at net.sf.hibernate.dialect.Dialect.getDialect(Dialect.java:294)
at net.sf.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:46)
at net.sf.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:37)
at com.logis.proyecto.persistence.MainClass.exportTables(MainClass.java:36)
at com.logis.proyecto.persistence.MainClass.main(MainClass.java:93)
If you have any suggestions ...
sylvain_2020