Beginner |
|
Joined: Thu Jan 08, 2004 4:40 am Posts: 48 Location: Bangkok, Thailand
|
Hi We think this can help you, you can just take out @hibernate.class from Persistent class and keep all the rest as it's. This might work because We also implement in this way as well. This is my Class detail.
package com.netplus.workstation.user.hibernate.entity;
import java.io.Serializable;
public abstract class HibernateEntity implements Serializable {
protected Long id; protected String name;
/** * @hibernate.id * generator-class="assigned" * unsaved-value="null" * @castor.field * type = "java.lang.Long" * @castor.field-xml * name = "id" * node = "attribute" */ public Long getId() { return this.id; }
public void setId(Long id) { this.id = id; }
/** * @hibernate.property * @castor.field * type = "java.lang.String" * @castor.field-xml * name = "name" * node = "attribute" */ public String getName() { return this.name; }
public void setName(String name) { this.name = name; } public int hashCode(){ return this.id.intValue(); } }
===============================================
package com.netplus.workstation.user.hibernate.entity;
import com.netplus.workstation.user.Group; import com.netplus.workstation.user.User; import java.security.Principal; import java.util.Enumeration; import java.util.Set; import java.util.Iterator; import java.util.HashSet; import java.util.Vector;
/** * @hibernate.class table="GROUPS" */ public class HibernateGroup extends HibernateEntity implements Group { private String description; private Set users;
/** * @hibernate.property */ public String getDescription() { return this.description; }
public void setDescription(String description) { this.description = description; }
/** * @hibernate.set name="users" lazy="false" table="GROUPS_USERS" * @hibernate.collection-key column="groupId" * @hibernate.collection-many-to-many column="userId" * class="com.netplus.workstation.user.hibernate.entity.HibernateUser" */ public Set getUsers() { return this.users; } ......................................
==============================================================
package com.netplus.workstation.user.hibernate.entity;
import com.netplus.workstation.user.Group; import com.netplus.workstation.user.User; import java.util.*;
/** * @hibernate.class table="USERS" */ public class HibernateUser extends HibernateEntity implements User {
private String password; private Set groups;
/** * @hibernate.property * @castor.field * type = "java.lang.String" * * @castor.field-xml * name = "password" * node = "attribute" */ public String getPassword() { return this.password; }
public void setPassword(String password) { this.password = password; } /** * @hibernate.set name="groups" lazy="false" table="GROUPS_USERS" * @hibernate.collection-key column="userId" * @hibernate.collection-many-to-many column="groupId" * class="com.netplus.workstation.user.hibernate.entity.HibernateGroup" * * @castor.field * type = "com.netplus.workstation.user.hibernate.entity.HibernateGroup" * collection = "set" */ public Set getGroups() { return this.groups; }
public void setGroups(Set groups) { this.groups = groups; }
By the way, we use Xdoclet1.2 with maven..Thanks balloonMan for source code
_________________ <name>arin</name>
<at>netplus software</at>
|
|