小编use*_*409的帖子

@ManyToMany在一个抽象的MappedSuperclass中

我的hibernate项目有以下设计:

@MappedSuperclass
public abstract class User {
    private List<Profil>    profile;

    @ManyToMany (targetEntity=Profil.class)
    public List<Profil> getProfile(){
        return profile;
    }
    public void setProfile(List<Profil> profile) {
        this.profile = profile;
    }
}

@Entity
@Table(name="client")
public class Client extends User {
    private Date    birthdate;
    @Column(name="birthdate")
    @Temporal(TemporalType.TIMESTAMP)
    public Date getBirthdate() {
        return birthdate;
    }
    public void setBirthdate(Date birthdate) {
        this.birthdate= birthdate;
    }
}

@Entity
@Table(name="employee")
public class Employee extends User {
    private Date    startdate;
    @Column(name="startdate")
    @Temporal(TemporalType.TIMESTAMP)
    public Date getStartdate() {
        return startdate;
    }
    public void setStartdate(Date …
Run Code Online (Sandbox Code Playgroud)

java annotations hibernate

5
推荐指数
1
解决办法
3888
查看次数

标签 统计

annotations ×1

hibernate ×1

java ×1