Hi I am new to hibernate I need to do a query with multiple joins on tables with composite key, my database is mysql, when I execute the code I get this error in eclipse
11:21:45,838 ERROR JDBCExceptionReporter:72 - Unknown column 'rel_pv_mar0_.tc_par_id' in 'where clause'
Exception in thread "main" org.hibernate.exception.SQLGrammarException: could not execute query using iterate
at org.hibernate.exception.SQLStateConverter.convert( SQLStateConverter.java:67)
at org.hibernate.exception.JDBCExceptionHelper.conver t(JDBCExceptionHelper.java:43)
at org.hibernate.loader.hql.QueryLoader.iterate(Query Loader.java:420)
at org.hibernate.hql.ast.QueryTranslatorImpl.iterate( QueryTranslatorImpl.java:318)
at org.hibernate.engine.query.HQLQueryPlan.performIte rate(HQLQueryPlan.java:177)
at org.hibernate.impl.SessionImpl.iterate(SessionImpl .java:1156)
at org.hibernate.impl.QueryImpl.iterate(QueryImpl.jav a:46)
at PvSelect.marchi(PvSelect.java:92)
at PvSelect.main(PvSelect.java:294)
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorEx ception: Unknown column 'rel_pv_mar0_.tc_par_id' in 'where clause'
at sun.reflect.NativeConstructorAccessorImpl.newInsta nce0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInsta nce(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newI nstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Construc tor.java:532)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:41 1)
at com.mysql.jdbc.Util.getInstance(Util.java:386)
at com.mysql.jdbc.SQLError.createSQLException(SQLErro r.java:1052)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.ja va:3597)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.ja va:3529)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:19 90)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java :2151)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionIm pl.java:2625)
at com.mysql.jdbc.PreparedStatement.executeInternal(P reparedStatement.java:2119)
at com.mysql.jdbc.PreparedStatement.executeQuery(Prep aredStatement.java:2281)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(Ab stractBatcher.java:139)
at org.hibernate.loader.Loader.getResultSet(Loader.ja va:1669)
at org.hibernate.loader.hql.QueryLoader.iterate(Query Loader.java:397)
... 6 more


here it is my query in hibernate
Java Code:
select p.id,p.azienda,tccl.testo, tcm.testo,tccl.ordine  from rel_pv_mar rpm,tc_mar tcm ,pv p,tc_clmar tccl where rpm.tc_mar_id=tcm.tc_mar_id  and rpm.tc_clmar_id=tccl.tc_clmar_id and p.id=rpm.pv_id and p.id=792 order by tccl.ordine



my entities
1)
rel_pv_mar.hbm.xml
Java Code:
<?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>
 <class entity-name="rel_pv_par" name="entita.Rel_pv_par" table="rel_pv_par">
 
 
 <composite-id>
        
       
        <key-property name="pv_id" column="pv_id" type="int" />
        <key-property name="tc_par_id" column="tc_par_id" type="int"/>
      
       

 
 

 
  </composite-id>
 
<property column="tc_clpar_id" name="tc_clpar_id" type="int"></property>
<property column="ins_data" name="ins_data" type="date"></property>
<property column="mod_utente"  name="mod_utente" type="date"></property>
<property column="mod_data"  name="mod_data" type="date"></property>
<property column="ins_utente"  name="ins_utente" type="date"></property>
		
 </class>
</hibernate-mapping>
2)
tc_mar.hbm.xml
Java Code:
<?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>
 <class entity-name="tc_mar" name="entita.Tc_mar" table="tc_mar">
  <id column="tc_mar_id" name="tc_mar_id">
   <generator class="assigned"/>
  </id>
 

<property column="tc_stato_id" name="tc_stato_id" type="long"></property>
<property column="testo" name="testo" type="string"></property>
<property column="ordine" name="ordine" type="long"></property>
<property column="ins_data" name="ins_data" type="date"></property>
<property column="mod_utente"  name="mod_utente" type="date"></property>
<property column="mod_data"  name="mod_data" type="date"></property>
<property column="ins_utente"  name="ins_utente" type="date"></property>
		
 </class>
</hibernate-mapping>
3) pv.hbm.xml
Java Code:
<?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>
 <class entity-name="pv" name="entita.Pv" table="pv">
  <id column="pv_id" name="id">
   <generator class="assigned"/>
  </id>
  <property column="nome1" generated="never" lazy="false" name="azienda" type="string"/>
  <property column="nome2" name="titolare" type="string"/>
 </class>
</hibernate-mapping>
4)tc_clmar.hbm.xml

Java Code:
<?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>
 <class entity-name="tc_clmar" name="entita.Tc_clmar" table="tc_clmar">
  <id column="tc_clmar_id" name="tc_clmar_id">
   <generator class="assigned"/>
  </id>
 
<property column="tc_stato_id" name="tc_stato_id" type="long"></property>
<property column="testo" name="testo" type="string"></property>
<property column="ordine" name="ordine" type="long"></property>
<property column="ins_data" name="ins_data" type="date"></property>
<property column="mod_utente"  name="mod_utente" type="date"></property>
<property column="mod_data"  name="mod_data" type="date"></property>
<property column="ins_utente"  name="ins_utente" type="date"></property>
		
 </class>
</hibernate-mapping>
hibernate.cfg.xml
Java Code:
<?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 name="">
  <!-- Database connection settings -->
  <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
  <property name="connection.url">jdbc:mysql://localhost:3306/parafarmacie</property>
  <property name="dialect">org.hibernate.dialect.MySQLDialect</property>
  <property name="connection.username">root</property>
  <property name="connection.password">vilu7240</property>
  <!-- JDBC connection pool (use the built-in) -->
  <property name="connection.pool_size">2</property>
  <!-- SQL dialect 
 Enable Hibernate's automatic session context management -->
  <property name="current_session_context_class">thread</property>
  <!-- Disable the second-level cache -->
  <property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
  <!-- Echo all executed SQL to stdout -->
  <property name="show_sql">false</property>
  <mapping class="entita.Pv" resource="entita/Pv.hbm.xml"/>
  <mapping class="entita.Tc_par" resource="entita/Tc_par.hbm.xml"/>
  <mapping class="entita.Rel_pv_par" resource="entita/rel_pv_par.hbm.xml"/>
  <mapping class="entita.Tc_pot" resource="entita/tc_pot.hbm.xml"/>
  <mapping class="entita.Tc_clpot" resource="entita/tc.clpot.hbm.xml"/>
  <mapping class="entita.Rel_pv_pot" resource="entita/rel_pv_pot.hbm.xml"/>
  <mapping class="entita.Tc_cl_par" resource="entita/tc_cl_par.hbm.xml"/>
  <mapping class="entita.Tc_clpar" resource="entita/tc_clpar.hbm.xml"/>
  <mapping class="entita.Rel_pv_mar" resource="entita/rel_pv_mar.hbm.xml"/>
  <mapping class="entita.Tc_mar" resource="entita/tc_mar.hbm.xml"/>
  <mapping class="entita.Tc_clmar" resource="entita/tc_clmar.hbm.xml"/>
 </session-factory>
</hibernate-configuration>
I am not able to understand my mistakes,can somebody help me please?
Thanks in advance