Using xdoclet to generate hibernate one to many relation
How to generate one to many hibernate relation with xdoclet.
I begin with looking at the sample availabe in the internet and ebook. Both of the resource bring me to something like this...
I tried it out. But it give me the following error:
Reason: java.lang.RuntimeException: no element tag deined in class YYY for xxxSet
Then i tried to solved it using a lot different way. After one day searching on my best friend (google). Finally i come to this url that solved my problem easily.
The solution is just to remove the "collection" word. The solution is as follow:
The problem is due to the fact that i am using xdoclet2 from maven instead of xdoclet1 from sourceforge. Thus they have different syntax.
I begin with looking at the sample availabe in the internet and ebook. Both of the resource bring me to something like this...
/**
* @hibernate.set cascade = "save-update"
* lazy = "true" inverse = "false"
*
* @hibernate.collection-one-to-many class = "com.xxx.yyy.ggg.vo.ManySide"
* @hibernate.collection-key column = "fk_OneSide"
*/
public Set getXxxSet() {
return manySet;
}
public void setXxxSet(Set xxxSet) {
this.xxxSet = xxxSet;
}
I tried it out. But it give me the following error:
Reason: java.lang.RuntimeException: no element tag deined in class YYY for xxxSet
Then i tried to solved it using a lot different way. After one day searching on my best friend (google). Finally i come to this url that solved my problem easily.
The solution is just to remove the "collection" word. The solution is as follow:
/**
* @hibernate.set cascade = "save-update"
* lazy = "true" inverse = "false"
*
* @hibernate.one-to-many class = "com.xxx.yyy.ggg.vo.ManySide"
* @hibernate.key column = "fk_OneSide"
*/
public Set getXxxSet() {
return manySet;
}
public void setXxxSet(Set xxxSet) {
this.xxxSet = xxxSet;
}
The problem is due to the fact that i am using xdoclet2 from maven instead of xdoclet1 from sourceforge. Thus they have different syntax.