-->
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.  [ 2 posts ] 
Author Message
 Post subject: Projections.projectionList() relation many-to-one don't work
PostPosted: Thu May 05, 2005 12:27 pm 
Regular
Regular

Joined: Thu Feb 24, 2005 2:34 pm
Posts: 80
Hibernate version:3rc1
Hi, i'm trying to use criteria in this way


Criteria crit = session.createCriteria(CVenditaVO.class)
.createAlias("modevo", "r")
.setProjection(Projections.projectionList()
.add(Projections.property("r.cmpfmo.cdc_cmpf"))
.add(Projections.property("r.cmpfmo.dsc_cmpf"))
.add(Projections.property("modedi"))
)
.add(Restrictions.eq("pk.shopdi", shop))
.add(Restrictions.eq("pk.datadi", data));


but hibernate throws
could not resolve property: cmpfmo.cdc_cmpf of: vo.as400.ModeVO"
Have you some idea, can you help
Devis





Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping SYSTEM "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
<hibernate-mapping>

<class name="vo.as400.CVenditaVO" table="sdgtwb_pdm.vendit00f" lazy="false" >

         <composite-id name="pk" class="vo.pk.CVenditaPK">
              <key-property name="shopdi" column="shopdi" />
              <key-property name="datadi" column="datadi" type="dao.hibernate.DateConversion" />
              <key-property name="oravdi" column="oravdi"/>
              <key-property name="nrscdi" column="nrscdi"/>
             
             
        </composite-id>





        <property name="stagdi"  column="stagdi" type="dao.hibernate.TrimmedString"/>
        <property name="modedi"  column="modedi" type="dao.hibernate.TrimmedString"/>
        <property name="matedi"  column="matedi" type="dao.hibernate.TrimmedString"/>
        <property name="colodi"  column="colodi" type="dao.hibernate.TrimmedString"/>
        <property name="varidi"  column="varidi" type="dao.hibernate.TrimmedString"/>
        <property name="qtavdi"  column="qtavdi" />
        <property name="pupbdi"  column="pupbdi" />
        <property name="pvendi"  column="pvendi" />
        <property name="scondi"  column="scondi" />
        <property name="tipodi"  column="tipodi" />
        <property name="cdtgdi"  column="cdtgdi" />
        <property name="tgsidi"  column="tgsidi" />
        <property name="magpdi"  column="magpdi" />
       

   <many-to-one name="modevo" class="vo.as400.ModeVO" lazy="false" update="false" insert="false"  not-null="true">
      <column name="STAGDI"/>
      <column name="MODEDI"/>
   </many-to-one>
   
        </class>



</hibernate-mapping>




<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping SYSTEM "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
<hibernate-mapping>

   
   <class name="vo.as400.ModeVO" table="sdgtwb_dat.arcmo00f" lazy="false"
     dynamic-update="true"
     dynamic-insert="true"
   >
   
   
   <composite-id name="modevopk" class="vo.pk.ModeVOPK" >
                 <key-property name="stagmo" column="stagmo" type="string"/>
                 <key-property name="modemo" column="modemo" type="string"/>
        </composite-id>
       
       

         <property name="stremo"  column="stremo" type="dao.hibernate.TrimmedString"/>
         <property name="nrazmo"  column="nrazmo"/>
         <property name="dtummo"  column="dtummo"/>
         <property name="orummo"  column="orummo"/>
         <property name="blremo"  column="blremo" type="dao.hibernate.TrimmedString"/>
         <property name="tpmomo"  column="tpmomo" type="dao.hibernate.TrimmedString"/>
         <property name="de20mo"  column="de20mo" type="dao.hibernate.TrimmedString"/>
         <property name="da30mo"  column="da30mo" type="dao.hibernate.TrimmedString"/>
         <property name="rfdimo"  column="rfdimo" type="dao.hibernate.TrimmedString"/>
         <property name="cartmo"  column="cartmo" type="dao.hibernate.TrimmedString"/>
         <property name="umgemo"  column="umgemo" type="dao.hibernate.TrimmedString"/>
         <property name="umavmo"  column="umavmo" type="dao.hibernate.TrimmedString"/>
         <property name="fumamo"  column="fumamo"/>
         <property name="moeqmo"  column="moeqmo" type="dao.hibernate.TrimmedString"/>
         <property name="marcmo"  column="marcmo" type="dao.hibernate.TrimmedString"/>
         <property name="linemo"  column="linemo" type="dao.hibernate.TrimmedString"/>
         <property name="slinmo"  column="slinmo" type="dao.hibernate.TrimmedString"/>
         <property name="marpmo"  column="marpmo" type="dao.hibernate.TrimmedString"/>
         <property name="linpmo"  column="linpmo" type="dao.hibernate.TrimmedString"/>
         <property name="slipmo"  column="slipmo" type="dao.hibernate.TrimmedString"/>
         
         <property name="crtgmo"  column="crtgmo" type="dao.hibernate.TrimmedString"/>
         <property name="tgbamo"  column="tgbamo" type="dao.hibernate.TrimmedString"/>
         <property name="ctg1mo"  column="ctg1mo" type="dao.hibernate.TrimmedString"/>
         <property name="ctg2mo"  column="ctg2mo" type="dao.hibernate.TrimmedString"/>
         <property name="ctg3mo"  column="ctg3mo" type="dao.hibernate.TrimmedString"/>
         <property name="ctg4mo"  column="ctg4mo" type="dao.hibernate.TrimmedString"/>
         <property name="ctg5mo"  column="ctg5mo" type="dao.hibernate.TrimmedString"/>
         <property name="tga1mo"  column="tga1mo" type="dao.hibernate.TrimmedString"/>
         <property name="tga2mo"  column="tga2mo" type="dao.hibernate.TrimmedString"/>
         <property name="tga3mo"  column="tga3mo" type="dao.hibernate.TrimmedString"/>
         <property name="tga4mo"  column="tga4mo" type="dao.hibernate.TrimmedString"/>
         <property name="tga5mo"  column="tga5mo" type="dao.hibernate.TrimmedString"/>
         <property name="tpr1mo"  column="tpr1mo" type="dao.hibernate.TrimmedString"/>
         <property name="tpr2mo"  column="tpr2mo" type="dao.hibernate.TrimmedString"/>
         <property name="tpr3mo"  column="tpr3mo" type="dao.hibernate.TrimmedString"/>
         <property name="tpr4mo"  column="tpr4mo" type="dao.hibernate.TrimmedString"/>
         <property name="tpr5mo"  column="tpr5mo" type="dao.hibernate.TrimmedString"/>
         <property name="drsbmo"  column="drsbmo" type="dao.hibernate.TrimmedString"/>
         <property name="drs1mo"  column="drs1mo" type="dao.hibernate.TrimmedString"/>
         <property name="drs2mo"  column="drs2mo" type="dao.hibernate.TrimmedString"/>
         <property name="drs3mo"  column="drs3mo" type="dao.hibernate.TrimmedString"/>
         <property name="drs4mo"  column="drs4mo" type="dao.hibernate.TrimmedString"/>
         <property name="drs5mo"  column="drs5mo" type="dao.hibernate.TrimmedString"/>
         <property name="fcommo"  column="fcommo" type="dao.hibernate.TrimmedString"/>
         <property name="ablamo"  column="ablamo" type="dao.hibernate.TrimmedString"/>
         <property name="cma1mo"  column="cma1mo" type="dao.hibernate.TrimmedString"/>
         <property name="cma2mo"  column="cma2mo" type="dao.hibernate.TrimmedString"/>
         <property name="cma3mo"  column="cma3mo" type="dao.hibernate.TrimmedString"/>
         <property name="cma4mo"  column="cma4mo" type="dao.hibernate.TrimmedString"/>
         <property name="cma5mo"  column="cma5mo" type="dao.hibernate.TrimmedString"/>
         <property name="fla1mo"  column="fla1mo" type="dao.hibernate.TrimmedString"/>
         <property name="fla2mo"  column="fla2mo" type="dao.hibernate.TrimmedString"/>
         <property name="fla3mo"  column="fla3mo" type="dao.hibernate.TrimmedString"/>
         <property name="fla4mo"  column="fla4mo" type="dao.hibernate.TrimmedString"/>
         <property name="fla5mo"  column="fla5mo" type="dao.hibernate.TrimmedString"/>
         <property name="fla6mo"  column="fla6mo" type="dao.hibernate.TrimmedString"/>
         <property name="fla7mo"  column="fla7mo" type="dao.hibernate.TrimmedString"/>
         <property name="fla8mo"  column="fla8mo" type="dao.hibernate.TrimmedString"/>
         <property name="fl10mo"  column="fl10mo" type="dao.hibernate.TrimmedString"/>
         <property name="fl20mo"  column="fl20mo" type="dao.hibernate.TrimmedString"/>
         <property name="fl30mo"  column="fl30mo" type="dao.hibernate.TrimmedString"/>
         <property name="cmpf"    column="cmpfmo" type="dao.hibernate.TrimmedString"/>
         
         <many-to-one name="cmpfmo" class="vo.as400.CCmpf" lazy="false" update="false" insert="false">
                  <formula>'CMP'</formula>
                            <column name="cmpfmo"  />
   </many-to-one>

         
         </class>
</hibernate-mapping>



<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping SYSTEM "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
<hibernate-mapping>


   <class name="vo.as400.CCmpf" table="sdgtwb_dat.arctb00f" lazy="false" where ="cdtbtb in ('CMP')">


     <composite-id>
      <key-property name="tpo_tbl"    column="cdtbtb"/>
      <key-property name="cdc_cmpf"    column="cdeltb" type="dao.hibernate.TrimmedString"/>
         </composite-id>




        <property name="dsc_cmpf"  column="DATITB" type="string" />


       

   <filter name="cmpf" condition="CDTBTB IN (:tipo')"/>

        </class>

<filter-def name="cmpf">
<filter-param name="tipo" type="string"/>
</filter-def>

</hibernate-mapping>






Top
 Profile  
 
 Post subject:
PostPosted: Thu May 05, 2005 2:08 pm 
Senior
Senior

Joined: Tue Feb 08, 2005 5:26 pm
Posts: 157
Location: Montréal, Québec - Canada
The property cdc_cmpf of class vo.as400.CCmpf is not mapped as a property of your object.

I think you should try and map it:

Code:
<property name="cdc_cmpf"  column="cdeltb" type="dao.hibernate.TrimmedString"/>

_________________
Vincent Giguère
J2EE Developer


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.