快捷搜索:  as  test  1111  test aNd 8=8  test++aNd+8=8  as++aNd+8=8  as aNd 8=8

和记娱到h88285:Hibernate多对多双向关联(Annotation配置)



Role.java

package com.many2many.bean;

import java.util.Set;

import javax.persistence.CascadeType;

import javax.persistence.Column;

import javax.p和记娱到h88285ersistence.Entity;

import javax.persistence.GeneratedValue;

import javax.persistence.GenerationType;

import javax.persistence.Id;

import javax.persistence.ManyToMany;

import javax.persistence.Table;

@Entity

@Table(name="roles",catalog="Hibernate_Many2Many")

public class Role {

private int id;

private String name;

priv和记娱到h88285ate SetUser> users;

@Id

@Column(name="id")

@GeneratedValue(strategy=和记娱到h88285GenerationType.AUTO)

public int getId() {

return id;

}

public void setId(int id) {

this.id = id;

}

@Column(name="name")

public String getName() {和记娱到h88285

return name;

}

pu和记娱到h88285blic void setName(String name) {

this.name = name;

}

@ManyToMany(mappedBy="roles",cascade=CascadeType.ALL)

public SetUser> getUsers() {

return users;

}

public void setUsers(SetUser> users) {

this.users = users;

}

}

免责声明:以上内容源自网络,版权归原作者所有,如有侵犯您的原创版权请告知,我们将尽快删除相关内容。

您可能还会对下面的文章感兴趣: