-->
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: Composite IDs with XDoclet
PostPosted: Fri Aug 05, 2005 9:42 am 
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 a simple 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 11:59 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Don't include the class level Doclet markup on the composite key.


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

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


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 16, 2005 7:37 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Cool - no worries.


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.