-->
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.  [ 3 posts ] 
Author Message
 Post subject: Composite IDs
PostPosted: Thu Aug 04, 2005 4:14 pm 
Newbie

Joined: Thu Aug 04, 2005 3:51 pm
Posts: 10
Hi friends,

I'm trying to create mapping documents for classes with composite IDs using XDoclet. I have an entity class and an entityID class which holds the composite key. However, when I try to generate the doc using XDoclet, I get this error:

54 ) <<Class com.myco.myapp.dao.hibernate.entity.ImportGroupHibernateEntityID misses ID property>>

So does this meant that the entityID class also needs an ID property declared?

I've searched the Hibernate docs and this forum, XDoclet examples and docs and all over the net, but have only found bits and pieces; nothing that helps. So now I'm looking for a kind soul that could offer a pointer or two. My sincerest thanks in advance.


Here are my classes:

/** A business entity class representing an ImportGroup .
*
*
* @hibernate.class table="ImportGroup"
*/
public class ImportGroupHibernateEntity implements ImportGroup, Serializable, Cloneable
{
private ImportGroupHibernateEntityID id = null;
private Integer gRank = null;
private String text;

public void setImportGroupHibernateEntityID(ImportGroupHibernateEntityID igID)
{
id = igID;
}

/**
*
* @return
* @hibernate.id generator-class="assigned" type="com.myco.myapp.dao.hibernate.entity.ImportGroupHibernateEntityID"
*
*/
public ImportGroupHibernateEntityID getImportGroupHibernateEntityID()
{
return(id);
}


/**
*@hibernate.property column="C3"
* type="java.lang.Integer"
*/
public Integer getGRank()
{
return (gRank);
}
public void setGRank(Integer integer1)
{
gRank = integer1;
}


}

}



/** A composite id class for entity ImportGroup .
*
*
* @hibernate.class table="ImportGroup"
*/

public class ImportGroupHibernateEntityID implements Serializable, Cloneable
{
private String typID = null;
private String pTypID = null;


/**
* @return
* @hibernate.property column="C1"
* type="java.lang.String"
*/
public String getTypID()
{
return(typID);
}

public void setTypID(String string)
{
typID = string;
}


/**
* @return
* @hibernate.property column="C2"
* type="java.lang.String"
*/
public String getPTypID()
{
return(pTypID);
}
public void setPTypID(String string)
{
pTypID = string;
}


public boolean equals(Object o)
{
if (o == null) { return false; }

if (getClass().equals(o.getClass()) &&
typID.equals(((ImportGroupHibernateEntityID) o).getTypID()) &&
pTypID.equals(((ImportGroupHibernateEntityID) o).getPTypID()))
{
return true;
}
else
{
return false;
}

}

public int hashCode()
{
return typID.hashCode();
}

}


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 05, 2005 6:19 pm 
Regular
Regular

Joined: Thu Dec 02, 2004 7:11 am
Posts: 85
You should not declare ImportGroupHibernateEntityID as "@hibernate.class" - this tag is for entity classes only.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 08, 2005 1:37 pm 
Newbie

Joined: Thu Aug 04, 2005 3:51 pm
Posts: 10
It works now, thank you!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.