Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: Composite ID Example?
PostPosted: Wed Nov 05, 2003 8:14 am 
Regular
Regular

Joined: Fri Sep 12, 2003 12:40 pm
Posts: 65
I'm a little confused about the composite-id syntax. I read the documentation, and looked through *many* of the forum posts on this topic, but I haven't found a complete example. Perhaps this can be one.

I have 4 legacy tables:

Division -> Group -> Department -> Employee

Division has a 1 to many relationship with Group,
Group has a 1 to many relationship with Department and,
Department has a 1 to many relationship with Employee.

Divisions table looks like:

divCode char(2)
name varchar(30)
primary key(divCode)

Grouptable looks like:

divCode char(2)
grpCode char(2)
name varchar(30)
primary key(divCode, grpCode)


Department table looks like:

divCode char(2)
grpCode char(2)
dptCode char(3)
name varchar(30)
primary key(divCode, grpCode, dptCode)


Employee table looks like:

divCode char(2)
grpCode char(2)
dptCode char(3)
empCode char(6)
firstName varchar(50)
lastName varchar(50)
primary key(divCode, grpCode, dptCode, empCode)



I created classes similar to:

Code:
public class DivisionId implements Serializable {
  private String myDivisionCode;

  public DivisionId() {
    super();
  }
 
  public DivisionId(String divCode){
     this();
     myDivCode = divCode;
  }

  public String getDivCode() {
    return myDivCode;
  }

  public void setDivCode(String string) {
    myDivCode = string;
  }



Code:
public class GroupId implements Serializable {
  private DivisionId myDivisionId;
  private String myGroupCode;

  public GroupId() {
    super();
  }

  public GroupId(DivisionId divisionId, String grpCode) {
    this();
    myDivisionId = divisionId;
    myGroupCode = grpCode;
  }

  public String getGroupCode() {
    return myGroupCode;
  }

  public DivisionId getDivisionId() {
    return myDivisionId;
  }

  public void setGroupCode(String string) {
    myGroupCode = string;
  }

  public void setDivisionId(DivisionId id) {
    myDivisionId = id;
  }

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

  public int hashCode() {
    return new HashCodeBuilder().append(getDivisionId()).append(getGroupCode()).toHashCode();
  }

}



I thought that it made sense to use the parent ID in the child, however, I can't find any examples that described except:

this or this


Is it possible to map the ids in this manner? Or do each of the columns have to be mapped individually in the <key> tag of the hbm.xml file?


P.S. The documentation is good, but it would be great if it included table layouts and relationships (via an ERD) in the examples for completeness. Sometimes the syntax and it's effect on the model is not obvious by the hbm.xml file.

_________________
- Brian


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 05, 2003 7:59 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Try out MIddlegen r3 against your schema and see what it generates.


Top
 Profile  
 
 Post subject: Sweet.
PostPosted: Mon Nov 10, 2003 1:59 pm 
Regular
Regular

Joined: Fri Sep 12, 2003 12:40 pm
Posts: 65
com.paraware.eg.Thanks.

I'll post the results here for future reference:

Here's the Hibernate Mapping Files:

Division
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >
   
<hibernate-mapping>
<!--
    Created by Middlegen Hibernate plugin

    http://boss.bekk.no/boss/middlegen/
    http://hibernate.sourceforge.net/
-->

<class
    name="eg.composite.Division"
    table="DIVISION"
>

    <id
        name="divCd"
        type="java.lang.String"
        column="DIV_CD"
    >
        <generator class="assigned" />
    </id>

    <property
        name="divDscTx"
        type="java.lang.String"
        column="DIV_DSC_TX"
        not-null="true"
        length="30"
    />
    <property
        name="rowUpdTs"
        type="java.sql.Timestamp"
        column="ROW_UPD_TS"
        not-null="true"
        length="26"
    />

    <!-- associations -->
    <!-- bi-directional one-to-many association to Grp -->
    <set
        name="grps"
        lazy="true"
        inverse="true"
    >
        <key>
            <column name="DIV_CD" />
        </key>
        <one-to-many
            class="eg.composite.Grp"
        />
    </set>

</class>
</hibernate-mapping>


Grp

Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >
   
<hibernate-mapping>
<!--
    Created by Middlegen Hibernate plugin

    http://boss.bekk.no/boss/middlegen/
    http://hibernate.sourceforge.net/
-->

<class
    name="eg.composite.Grp"
    table="GRP"
>

    <composite-id name="comp_id" class="eg.composite.GrpPK">
        <key-property
            name="grpCd"
            column="GRP_CD"
            type="java.lang.String"
            length="3"
        />
        <!-- bi-directional many-to-one association to Division -->
        <key-many-to-one
           name="division"
           class="eg.composite.Division"
       >
           <column name="DIV_CD" />
       </key-many-to-one>
    </composite-id>   

    <property
        name="grpDscTx"
        type="java.lang.String"
        column="GRP_DSC_TX"
        not-null="true"
        length="30"
    />
    <property
        name="rowUpdTs"
        type="java.sql.Timestamp"
        column="ROW_UPD_TS"
        not-null="true"
        length="26"
    />

    <!-- associations -->
    <!-- bi-directional one-to-many association to Dpt -->
    <set
        name="dpts"
        lazy="true"
        inverse="true"
    >
        <key>
            <column name="DIV_CD" />
            <column name="GRP_CD" />
        </key>
        <one-to-many
            class="eg.composite.Dpt"
        />
    </set>

</class>
</hibernate-mapping>


Dpt
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >
   
<hibernate-mapping>
<!--
    Created by Middlegen Hibernate plugin

    http://boss.bekk.no/boss/middlegen/
    http://hibernate.sourceforge.net/
-->

<class
    name="eg.composite.Dpt"
    table="DPT"
>

    <composite-id name="comp_id" class="eg.composite.DptPK">
        <key-property
            name="dptCd"
            column="DPT_CD"
            type="java.lang.String"
            length="5"
        />
        <!-- bi-directional many-to-one association to Grp -->
        <key-many-to-one
           name="grp"
           class="eg.composite.Grp"
       >
           <column name="DIV_CD" />
           <column name="GRP_CD" />
       </key-many-to-one>
    </composite-id>   

    <property
        name="dptDscTx"
        type="java.lang.String"
        column="DPT_DSC_TX"
        not-null="true"
        length="30"
    />
    <property
        name="rowUpdTs"
        type="java.sql.Timestamp"
        column="ROW_UPD_TS"
        not-null="true"
        length="26"
    />

    <!-- associations -->
    <!-- bi-directional one-to-many association to Employee -->
    <set
        name="employees"
        lazy="true"
        inverse="true"
    >
        <key>
            <column name="DIV_CD" />
            <column name="GRP_CD" />
            <column name="DPT_CD" />
        </key>
        <one-to-many
            class="eg.composite.Employee"
        />
    </set>

</class>
</hibernate-mapping>


Employee
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >
   
<hibernate-mapping>
<!--
    Created by Middlegen Hibernate plugin

    http://boss.bekk.no/boss/middlegen/
    http://hibernate.sourceforge.net/
-->

<class
    name="eg.composite.Employee"
    table="EMPLOYEE"
>

    <id
        name="empId"
        type="java.lang.String"
        column="EMP_ID"
    >
        <generator class="assigned" />
    </id>

    <property
        name="fstNamTx"
        type="java.lang.String"
        column="FST_NAM_TX"
        not-null="true"
        length="50"
    />
    <property
        name="lstNamTx"
        type="java.lang.String"
        column="LST_NAM_TX"
        not-null="true"
        length="50"
    />
    <property
        name="rowUpdTs"
        type="java.sql.Timestamp"
        column="ROW_UPD_TS"
        not-null="true"
        length="26"
    />

    <!-- associations -->
    <!-- bi-directional many-to-one association to Dpt -->
    <many-to-one
        name="dpt"
        class="eg.composite.Dpt"
        not-null="true"
    >
        <column name="DIV_CD" />
        <column name="GRP_CD" />
        <column name="DPT_CD" />
    </many-to-one>

</class>
</hibernate-mapping>

_________________
- Brian


Top
 Profile  
 
 Post subject: Forgot the Java classes
PostPosted: Tue Nov 11, 2003 12:06 pm 
Regular
Regular

Joined: Fri Sep 12, 2003 12:40 pm
Posts: 65
Here are the created java classes:

Division:

Code:
package eg.composite;

import java.io.Serializable;
import java.util.Set;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

/** @author Hibernate CodeGenerator */
public class Division implements Serializable {

    /** identifier field */
    private String divCd;

    /** persistent field */
    private String divDscTx;

    /** persistent field */
    private java.util.Date rowUpdTs;

    /** persistent field */
    private Set grps;

    /** full constructor */
    public Division(java.lang.String divCd, java.lang.String divDscTx, java.util.Date rowUpdTs, Set grps) {
        this.divCd = divCd;
        this.divDscTx = divDscTx;
        this.rowUpdTs = rowUpdTs;
        this.grps = grps;
    }

    /** default constructor */
    public Division() {
    }

    public java.lang.String getDivCd() {
        return this.divCd;
    }

    public void setDivCd(java.lang.String divCd) {
        this.divCd = divCd;
    }

    public java.lang.String getDivDscTx() {
        return this.divDscTx;
    }

    public void setDivDscTx(java.lang.String divDscTx) {
        this.divDscTx = divDscTx;
    }

    public java.util.Date getRowUpdTs() {
        return this.rowUpdTs;
    }

    public void setRowUpdTs(java.util.Date rowUpdTs) {
        this.rowUpdTs = rowUpdTs;
    }

    public java.util.Set getGrps() {
        return this.grps;
    }

    public void setGrps(java.util.Set grps) {
        this.grps = grps;
    }

    public String toString() {
        return new ToStringBuilder(this)
            .append("divCd", getDivCd())
            .toString();
    }

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

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

}


Code:
package eg.composite;

import java.io.Serializable;
import java.util.Set;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

/** @author Hibernate CodeGenerator */
public class Grp implements Serializable {

    /** identifier field */
    private eg.composite.GrpPK comp_id;

    /** persistent field */
    private String grpDscTx;

    /** persistent field */
    private java.util.Date rowUpdTs;

    /** persistent field */
    private Set dpts;

    /** full constructor */
    public Grp(eg.composite.GrpPK comp_id, java.lang.String grpDscTx, java.util.Date rowUpdTs, Set dpts) {
        this.comp_id = comp_id;
        this.grpDscTx = grpDscTx;
        this.rowUpdTs = rowUpdTs;
        this.dpts = dpts;
    }

    /** default constructor */
    public Grp() {
    }

    public eg.composite.GrpPK getComp_id() {
        return this.comp_id;
    }

    public void setComp_id(eg.composite.GrpPK comp_id) {
        this.comp_id = comp_id;
    }

    public java.lang.String getGrpDscTx() {
        return this.grpDscTx;
    }

    public void setGrpDscTx(java.lang.String grpDscTx) {
        this.grpDscTx = grpDscTx;
    }

    public java.util.Date getRowUpdTs() {
        return this.rowUpdTs;
    }

    public void setRowUpdTs(java.util.Date rowUpdTs) {
        this.rowUpdTs = rowUpdTs;
    }

    public java.util.Set getDpts() {
        return this.dpts;
    }

    public void setDpts(java.util.Set dpts) {
        this.dpts = dpts;
    }

    public String toString() {
        return new ToStringBuilder(this)
            .append("comp_id", getComp_id())
            .toString();
    }

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

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

}


GroupPK
Code:
package eg.composite;

import java.io.Serializable;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

/** @author Hibernate CodeGenerator */
public class GrpPK implements Serializable {

    /** identifier field */
    private String grpCd;

    /** identifier field */
    private eg.composite.Division division;

    /** full constructor */
    public GrpPK(java.lang.String grpCd, eg.composite.Division division) {
        this.grpCd = grpCd;
        this.division = division;
    }

    /** default constructor */
    public GrpPK() {
    }

    public java.lang.String getGrpCd() {
        return this.grpCd;
    }

    public void setGrpCd(java.lang.String grpCd) {
        this.grpCd = grpCd;
    }

    public eg.composite.Division getDivision() {
        return this.division;
    }

    public void setDivision(eg.composite.Division division) {
        this.division = division;
    }

    public String toString() {
        return new ToStringBuilder(this)
            .append("grpCd", getGrpCd())
            .append("division", getDivision())
            .toString();
    }

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

    public int hashCode() {
        return new HashCodeBuilder()
            .append(getGrpCd())
            .append(getDivision())
            .toHashCode();
    }

}


Dept
Code:
package eg.composite;

import java.io.Serializable;
import java.util.Set;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

/** @author Hibernate CodeGenerator */
public class Dpt implements Serializable {

    /** identifier field */
    private eg.composite.DptPK comp_id;

    /** persistent field */
    private String dptDscTx;

    /** persistent field */
    private java.util.Date rowUpdTs;

    /** persistent field */
    private Set employees;

    /** full constructor */
    public Dpt(eg.composite.DptPK comp_id, java.lang.String dptDscTx, java.util.Date rowUpdTs, Set employees) {
        this.comp_id = comp_id;
        this.dptDscTx = dptDscTx;
        this.rowUpdTs = rowUpdTs;
        this.employees = employees;
    }

    /** default constructor */
    public Dpt() {
    }

    public eg.composite.DptPK getComp_id() {
        return this.comp_id;
    }

    public void setComp_id(eg.composite.DptPK comp_id) {
        this.comp_id = comp_id;
    }

    public java.lang.String getDptDscTx() {
        return this.dptDscTx;
    }

    public void setDptDscTx(java.lang.String dptDscTx) {
        this.dptDscTx = dptDscTx;
    }

    public java.util.Date getRowUpdTs() {
        return this.rowUpdTs;
    }

    public void setRowUpdTs(java.util.Date rowUpdTs) {
        this.rowUpdTs = rowUpdTs;
    }

    public java.util.Set getEmployees() {
        return this.employees;
    }

    public void setEmployees(java.util.Set employees) {
        this.employees = employees;
    }

    public String toString() {
        return new ToStringBuilder(this)
            .append("comp_id", getComp_id())
            .toString();
    }

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

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

}


DptPK
Code:
package eg.composite;

import java.io.Serializable;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

/** @author Hibernate CodeGenerator */
public class DptPK implements Serializable {

    /** identifier field */
    private String dptCd;

    /** identifier field */
    private eg.composite.Grp grp;

    /** full constructor */
    public DptPK(java.lang.String dptCd, eg.composite.Grp grp) {
        this.dptCd = dptCd;
        this.grp = grp;
    }

    /** default constructor */
    public DptPK() {
    }

    public java.lang.String getDptCd() {
        return this.dptCd;
    }

    public void setDptCd(java.lang.String dptCd) {
        this.dptCd = dptCd;
    }

    public eg.composite.Grp getGrp() {
        return this.grp;
    }

    public void setGrp(eg.composite.Grp grp) {
        this.grp = grp;
    }

    public String toString() {
        return new ToStringBuilder(this)
            .append("dptCd", getDptCd())
            .append("grp", getGrp())
            .toString();
    }

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

    public int hashCode() {
        return new HashCodeBuilder()
            .append(getDptCd())
            .append(getGrp())
            .toHashCode();
    }

}


Employee
Code:
package eg.composite;

import java.io.Serializable;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

/** @author Hibernate CodeGenerator */
public class Employee implements Serializable {

    /** identifier field */
    private String empId;

    /** persistent field */
    private String fstNamTx;

    /** persistent field */
    private String lstNamTx;

    /** persistent field */
    private java.util.Date rowUpdTs;

    /** persistent field */
    private eg.composite.Dpt dpt;

    /** full constructor */
    public Employee(java.lang.String empId, java.lang.String fstNamTx, java.lang.String lstNamTx, java.util.Date rowUpdTs, eg.composite.Dpt dpt) {
        this.empId = empId;
        this.fstNamTx = fstNamTx;
        this.lstNamTx = lstNamTx;
        this.rowUpdTs = rowUpdTs;
        this.dpt = dpt;
    }

    /** default constructor */
    public Employee() {
    }

    public java.lang.String getEmpId() {
        return this.empId;
    }

    public void setEmpId(java.lang.String empId) {
        this.empId = empId;
    }

    public java.lang.String getFstNamTx() {
        return this.fstNamTx;
    }

    public void setFstNamTx(java.lang.String fstNamTx) {
        this.fstNamTx = fstNamTx;
    }

    public java.lang.String getLstNamTx() {
        return this.lstNamTx;
    }

    public void setLstNamTx(java.lang.String lstNamTx) {
        this.lstNamTx = lstNamTx;
    }

    public java.util.Date getRowUpdTs() {
        return this.rowUpdTs;
    }

    public void setRowUpdTs(java.util.Date rowUpdTs) {
        this.rowUpdTs = rowUpdTs;
    }

    public eg.composite.Dpt getDpt() {
        return this.dpt;
    }

    public void setDpt(eg.composite.Dpt dpt) {
        this.dpt = dpt;
    }

    public String toString() {
        return new ToStringBuilder(this)
            .append("empId", getEmpId())
            .toString();
    }

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

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

}

_________________
- Brian


Top
 Profile  
 
 Post subject: Querying Objects with Composite ID using HQL
PostPosted: Tue Nov 11, 2003 12:21 pm 
Regular
Regular

Joined: Fri Sep 12, 2003 12:40 pm
Posts: 65
OK,

I am interested in all of the departments where the grpPK is a certain value:

Code:
Division division = new Division();
division.setDivCd("01");
GrpPK grpPK = new GrpPK("001",division);

Object[] values = new Object[2];
values[0] = grpPK.getDivision().getDivCd(); // divCode
values[1] = grpPK.getGrpCd(); // GroupCode
Type[] types = new Type[2];
types[0] = Hibernate.STRING;
types[1] = Hibernate.STRING;
String query =   " from eg.composite.Dpt as dpt "+
" where dpt.comp_id.grp.comp_id.division.divCd = ? "+
" and dpt.comp_id.grp.comp_id.grpCd = ? " +
" order by dpt.comp_id.dptCd ";
setResult(session.find(query));


When I run this code, I receive:

Code:
net.sf.hibernate.QueryException: could not resolve property type: comp_id.grp.id.division.id [ from eg.composite.Dpt as dpt where dpt.comp_id.grp.comp_id.division.divCd = ? and dpt.comp_id.grp.comp_id.grpCd = ? order by dpt.comp_id.dptCd ]
   at net.sf.hibernate.hql.PathExpressionParser.getPropertyType(PathExpressionParser.java:235)
   at net.sf.hibernate.hql.PathExpressionParser.end(PathExpressionParser.java:281)
   at net.sf.hibernate.hql.WhereParser.doPathExpression(WhereParser.java:366)
   at net.sf.hibernate.hql.WhereParser.doToken(WhereParser.java:393)
   at net.sf.hibernate.hql.WhereParser.token(WhereParser.java:279)
   at net.sf.hibernate.hql.ClauseParser.token(ClauseParser.java:87)
   at net.sf.hibernate.hql.PreprocessingParser.token(PreprocessingParser.java:120)
   at net.sf.hibernate.hql.ParserHelper.parse(ParserHelper.java:29)
   at net.sf.hibernate.hql.QueryTranslator.compile(QueryTranslator.java:146)
   at net.sf.hibernate.hql.QueryTranslator.compile(QueryTranslator.java:133)
   at net.sf.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:352)
   at net.sf.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:330)
   at net.sf.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:1368)
   at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1332)
   at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1322)
   at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1314)


David, can you give me some words of wisdom on how to access a list of data using the PKs? Thanks

_________________
- Brian


Top
 Profile  
 
 Post subject: Path doesn't exist in the types map of the EntityPersister
PostPosted: Tue Nov 11, 2003 1:06 pm 
Regular
Regular

Joined: Fri Sep 12, 2003 12:40 pm
Posts: 65
David, sure enough it's not in the types map of the EntityPersister is:

The biggest path in the tree is:

comp_id.grp.id.division=net.sf.hibernate.type.ManyToOneType@34f445

Any ideas as to where I should be looking to fix this problem?

_________________
- Brian


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 11, 2003 1:08 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Are you sure you are using Hibernate 2.1?


Top
 Profile  
 
 Post subject: No.
PostPosted: Tue Nov 11, 2003 2:09 pm 
Regular
Regular

Joined: Fri Sep 12, 2003 12:40 pm
Posts: 65
I'm sure I'm using Hibernate 2.0.3. Thanks for the tip. I'll try it out.

_________________
- Brian


Top
 Profile  
 
 Post subject: Doh! My Test had an error in it.
PostPosted: Tue Nov 11, 2003 2:44 pm 
Regular
Regular

Joined: Fri Sep 12, 2003 12:40 pm
Posts: 65
After I moved up to Hibernate 2.1, I found out my test code had an error in it. The last line should have been:

setResult(session.find(query,values, types));

Doh!

_________________
- Brian


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 11, 2003 6:16 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Glad you sorted it out.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 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 2015, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.