I don't know how can atach a file to this reply but I think the problem is Mysql database. I ran a simple main application with the HQL early mention and same error I obtained. Then I put all for PostgreSQL and works fine. I didn't do that yet in HQL scratchpad for test.
The hibernate.cfg.xml file is
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.cglib.use_reflection_optimizer">true</property>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.password">agress04</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost:3336/merp</property>
<property name="hibernate.connection.username">merp04</property>
<property name="hibernate.default_schema">merp</property>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<mapping resource="com/agress/merp/model/Personal.hbm.xml" />
<!-- so on -->
</session-factory>
</hibernate-configuration>
Personal.hbm.xml file is
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<!--
Auto-generated mapping file from
the hibernate.org cfg2hbm engine
-->
<class name="com.agress.merp.model.Personal" table="personal" schema="merp">
<id name="personalId" type="string">
<column name="personalId" length="9" />
<generator class="assigned" />
</id>
<property name="nume" type="string">
<column name="nume" length="50" not-null="true" />
</property>
<property name="prenume" type="string">
<column name="prenume" length="50" not-null="true" />
</property>
<property name="cnp" type="string">
<column name="CNP" length="13" unique="true" />
</property>
<property name="dataNasterii" type="date">
<column name="data_nasterii" length="10" />
</property>
<property name="adresa" type="string">
<column name="adresa" length="75" />
</property>
<property name="localitate" type="string">
<column name="localitate" length="15" />
</property>
<property name="judet" type="string">
<column name="judet" length="15" />
</property>
<property name="serieActIdentitate" type="string">
<column name="serie_act_identitate" length="8" />
</property>
<property name="eliberatDe" type="string">
<column name="eliberat_de" length="20" />
</property>
<property name="dataEliberarii" type="date">
<column name="data_eliberarii" length="10" />
</property>
<property name="telefonFix" type="string">
<column name="telefon_fix" length="15" />
</property>
<property name="mobil" type="string">
<column name="mobil" length="15" />
</property>
<property name="email" type="string">
<column name="email" length="30" />
</property>
<property name="rezultat" type="integer">
<column name="rezultat" not-null="true" />
</property>
<property name="contorIncercari" type="integer">
<column name="contor_incercari" not-null="true" />
</property>
<property name="flag" type="integer">
<column name="flag" not-null="true" />
</property>
<set name="documenteGenerices" inverse="true">
<key>
<column name="primitorId" length="9" />
</key>
<one-to-many class="com.agress.merp.model.DocumenteGenerice" />
</set>
<set name="documenteGenerices_1" inverse="true">
<key>
<column name="agentId" length="9" />
</key>
<one-to-many class="com.agress.merp.model.DocumenteGenerice" />
</set>
<set name="utilizatoris" inverse="true">
<key>
<column name="PersonalId" length="9" not-null="true" unique="true" />
</key>
<one-to-many class="com.agress.merp.model.Utilizatori" />
</set>
<set name="departamentePersonals" inverse="true">
<key>
<column name="personalId" length="9" />
</key>
<one-to-many class="com.agress.merp.model.DepartamentePersonal" />
</set>
<set name="delegatis" inverse="true">
<key>
<column name="personalid" length="9" />
</key>
<one-to-many class="com.agress.merp.model.Delegati" />
</set>
<set name="contractes" inverse="true">
<key>
<column name="personal_aprobareId" length="9" />
</key>
<one-to-many class="com.agress.merp.model.Contracte" />
</set>
<set name="contractes_1" inverse="true">
<key>
<column name="personal_solicitantId" length="9" not-null="true" />
</key>
<one-to-many class="com.agress.merp.model.Contracte" />
</set>
<set name="soferis" inverse="true">
<key>
<column name="personalId" length="9" not-null="true" />
</key>
<one-to-many class="com.agress.merp.model.Soferi" />
</set>
<set name="coletes" inverse="true">
<key>
<column name="personalid" length="9" />
</key>
<one-to-many class="com.agress.merp.model.Colete" />
</set>
<set name="documenteGenerices_2" inverse="true">
<key>
<column name="personalId" length="9" />
</key>
<one-to-many class="com.agress.merp.model.DocumenteGenerice" />
</set>
<set name="personalLocatiis" inverse="true">
<key>
<column name="personalId" length="9" />
</key>
<one-to-many class="com.agress.merp.model.PersonalLocatii" />
</set>
<set name="gestionaris" inverse="true">
<key>
<column name="personalid" length="9" />
</key>
<one-to-many class="com.agress.merp.model.Gestionari" />
</set>
</class>
</hibernate-mapping>
This is the mapping file and config file that I changed for PostgreSQL and all was OKI, from standalone application, but didn't work for MySQL in same standalone application with right conf for database (obtain from reverse and seemed okie for me).
Thx in advance, ToniC
max wrote:
show me the generated hibernate.cfg.xml and one of the hbm.xmls.
yes auto complete is only implemented for the entity names at the moment.