-->
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: Help needed reg. hbm2java
PostPosted: Wed Nov 22, 2006 12:18 pm 
Newbie

Joined: Wed Nov 22, 2006 12:05 pm
Posts: 1
I am new to hibernate and trying to use hbm2java (using ant) for code generation from hbm.xml file...

i have simple tables Employee(id, name) and Applicant(id, REFERENCE_id, name).

REFERENCE_id in Applicant table is FK of id in Employee table. i wrote hbm.xml file for Employee as follows..

<?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 name="com.gs.persistence.doObjects.EmployeeDO" table="CH_EMPLOYEE">
<id name="id" column="EMPLOYEE_ID" type="integer">
<generator class="increment"/>
</id>

<property name="empFirstName" column="EMPLOYEE_NAME" type="String" />

<set name="referredApplicants" table="CH_APPLICANTS">
<key column="REFERENCE_ID"/>
<one-to-many class="com.gs.persistence.doObjects.ApplicantDO"/>
</set>
</class>
</hibernate-mapping>


IS THIS A RIGHT DECLARATION? IF SO....

i am getting EmployeeDO as follows...

package com.gs.persistence.doObjects;
// Generated Nov 22, 2006 8:50:00 PM by Hibernate Tools 3.2.0.beta8



/**
* EmployeeDO generated by hbm2java
*/
public class EmployeeDO implements java.io.Serializable {

// Fields

private Integer id;
private String empFirstName;

// Constructors

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

/** full constructor */
public EmployeeDO(String empFirstName) {
this.empFirstName = empFirstName;
}

// Property accessors
public Integer getId() {
return this.id;
}

public void setId(Integer id) {
this.id = id;
}
public String getEmpFirstName() {
return this.empFirstName;
}

public void setEmpFirstName(String empFirstName) {
this.empFirstName = empFirstName;
}
}

NO METHOD RELATED TO <set name="referredApplicants" ..... > got generated.

-------------------------
Hibernate VERSIONs are as follows..

Hibernate - hibernate-3.2
Hibernate Tools - HibernateTools-3.2.0.beta8.zip


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 23, 2006 11:33 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
looks weird.

submit a minimal but *complete mapping* to jira so i can look into it.
(e.g. i don't see the mapping for the ApplicantDO)

_________________
Max
Don't forget to rate


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:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.