您的位置:首页 > 其它

xdoclet在hibernate中的典型应用1

2007-06-08 15:18 183 查看
对表的声明

/**
* @hibernate.class table="author"
*/

一对一

/**
* @hibernate.one-to-one cascade="all" constrained="true"
*/
public Person getPerson() {
return person;
}

多对一、一对多

/**
* @hibernate.set lazy="true" inverse="true" cascade="all"
* @hibernate.collection-key column="authorid"
* @hibernate.collection-one-to-many class="com.cq.Publication"
*/
public Set getPublications() {
return publications;
}

/**
* @hibernate.many-to-one column="authorid"
*/
public Author getAuthor() {
return author;
}

多对多

/**
* @hibernate.set lazy="true" table="author_work"
* @hibernate.collection-key column="author_id"
* @hibernate.collection-many-to-many column="work_id" class="com.rq.Work"
*/
public Set getWorks() {
return works;
}

/**
* @hibernate.set lazy="true" table="author_work"
* @hibernate.collection-key column="work_id"
* @hibernate.collection-many-to-many column="author_id" class="com.rq.Author"
*/
public Set getAuthors() {
return authors;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: