-->
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.  [ 4 posts ] 
Author Message
 Post subject: Mapping Collection with multi column
PostPosted: Fri Mar 25, 2005 9:49 am 
Regular
Regular

Joined: Wed Sep 22, 2004 8:27 am
Posts: 89
Hibernate version:
Hibernate 3

Mapping documents:


Table: KFT_MODALITA

<hibernate-mapping default-lazy="false">

<class name="Modalita" table="KFT_MODALITA">
<composite-id name="id" class="ModalitaPk">
<key-many-to-one name="codintdmn" class="Dominio"/>
<key-property name="codint" />
</composite-id>

<property name="cafdsc" type="string">
<column name="cafdsc" length="1000" sql-type="string"/>
</property>
<set name="modalitaRuolo" lazy="true">
<key>
<column name="codintdmn"/>
<column name="codintmod"/>
</key>
<one-to-many class="com.coginfo.kf.bean.ModalitaRuolo"/>
</set>
</class>
</hibernate-mapping>

Table: KFT_MODALITA_RUOLO

<hibernate-mapping default-lazy="false">
<class name="com.coginfo.kf.bean.ModalitaRuolo" table="KFT_MODALITA_RUOLO">

<composite-id name="id" class="ModalitaRuoloPk">
<key-many-to-one name="codintmod" class="Modalita">
<column name="codintmod" />
<column name="codintdmn"/>
</key-many-to-one>
<key-many-to-one name="codintrul" class="Ruolo" /> </composite-id>
</class>
</hibernate-mapping>


Code between sessionFactory.openSession() and session.close():
session.createCriteria(Modalita.class).list();


Full stack trace of any exception that occurs:
org.hibernate.QueryException: could not resolve property: codintdmn of: com.coginfo.kf.bean.Modalita

Name and version of the database you are using:
Oracle 9i


I would ask you How can i map these two tables becouse i need to solve this problem. At this moment this mapping doesn't work

Plz help me!!


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 25, 2005 10:59 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
your class doesnt have that property.

-max

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 25, 2005 11:13 am 
Regular
Regular

Joined: Wed Sep 22, 2004 8:27 am
Posts: 89
I dont understand...

this is the code of my object:

Code:

MODALITA

public class Modalita extends PersistentEntity{
   
    private static String MODALITA_SEQUENCE = "modalita.sequence";
   
   protected ModalitaPk      id;
   protected String          cafdsc;
   protected Set             modalitaRuolo;

   
    public Modalita() {
       id = new ModalitaPk();
    }
   
    /**
     * @return Returns the cafdsc.
     */
    public String getCafdsc() {
        return cafdsc;
    }
    /**
     * @param cafdsc The cafdsc to set.
     */
    public void setCafdsc(String cafdsc) {
        this.cafdsc = cafdsc;
    }
   
    /**
     * @return Returns the modalitaRuolo.
     */
    public Set getModalitaRuolo() {
        return modalitaRuolo;
    }
    /**
     * @param modalitaRuolo The modalitaRuolo to set.
     */
    public void setModalitaRuolo(Set modalitaRuolo) {
        this.modalitaRuolo = modalitaRuolo;
    }
   
  /**
     * @return Returns the codintdmn.
     */
    public Dominio getCodintdmn() {
        return this.id.getCodintdmn();
    }
    /**
     * @param codintdmn The codintdmn to set.
     */
    public void setCodintdmn(Dominio codintdmn) {
        this.id.setCodintdmn(codintdmn);
    }
}


MODALITA_RUOLO

public class ModalitaRuolo extends PersistentEntity{
   
    private ModalitaRuoloPk  id;


   /**
     *
      */
   public ModalitaRuolo() {
       id = new  ModalitaRuoloPk();
      
    }   
   
    /**
      * Il toString di un PersistentEntity DEVE , qualora tale bean fosse utilizzato per un LookUp o simili
      * deve implementare il metodo in questa maniera.
      * 1) super.getToString()
      * 2) testare il risultato per null , se diverso utilizzare tale valore altrimenti procedere con l'algoritmo per il calcolo del toString
      */    
    public String toString(){
     return id.getCodintmod() + " - " + id.getCodintrul();
    }

    /**
     * @return Returns the id.
     */
    public ModalitaRuoloPk getId() {
        return id;
    }
    /**
     * @param id The id to set.
     */
    public void setId(ModalitaRuoloPk id) {
        this.id = id;
    }
}


PK MODALITA

public class ModalitaPk extends PkEntity{

    private Dominio   codintdmn;
    private Long      codint;

   
   public boolean equals(Object other) {
        if ( !(other instanceof ModalitaPk) ) return false;
        ModalitaPk castOther = (ModalitaPk) other;
        return new EqualsBuilder().append(this.getCodint(), castOther.getCodint()).append(this.getCodintdmn(), castOther.getCodintdmn()).isEquals(); 
      }

   public int hashCode() {
        return new HashCodeBuilder().append(getCodint()).append(getCodintdmn()).toHashCode();
   }
       

    /**
     * @return Returns the codint.
     */
    public Long getCodint() {
        return codint;
    }
    /**
     * @param codint The codint to set.
     */
    public void setCodint(Long codint) {
        this.codint = codint;
    }
    /**
     * @return Returns the codintdmn.
     */
    public Dominio getCodintdmn() {
        return codintdmn;
    }
    /**
     * @param codintdmn The codintdmn to set.
     */
    public void setCodintdmn(Dominio codintdmn) {
        this.codintdmn = codintdmn;
    }
}



PK MODALITA RUOLO
public class ModalitaRuoloPk extends PkEntity{
   private Modalita codintmod;
   private Ruolo    codintrul;
   
   
   public boolean equals(Object other) {
        if ( !(other instanceof ModalitaRuoloPk) ) return false;
        ModalitaRuoloPk castOther = (ModalitaRuoloPk) other;
        return new EqualsBuilder().append(this.getCodintmod(), castOther.getCodintmod()).append(this.getCodintrul(), castOther.getCodintrul()).isEquals(); 
      }

   public int hashCode() {
        return new HashCodeBuilder().append(getCodintmod()).append(getCodintrul()).toHashCode();
   }


    /**
     * @return Returns the codintmod.
     */
    public Modalita getCodintmod() {
        return codintmod;
    }
    /**
     * @param codintmod The codintmod to set.
     */
    public void setCodintmod(Modalita codintmod) {
        this.codintmod = codintmod;
    }
    /**
     * @return Returns the codintrul.
     */
    public Ruolo getCodintrul() {
        return codintrul;
    }
    /**
     * @param codintrul The codintrul to set.
     */
    public void setCodintrul(Ruolo codintrul) {
        this.codintrul = codintrul;
    }
}





The problem i think is "codintdmn" in a property of object "id" "ModalitaPk"


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 25, 2005 12:03 pm 
Regular
Regular

Joined: Wed Sep 22, 2004 8:27 am
Posts: 89
Plz help me, this is a big problem that stop myself...


any solution? thanks.


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