Hibernate 中间表有其他字段Annotation怎么注解
1个回答
2016-07-21
展开全部
如果你要在中间表中加其他字段,就只能新加一个表一个类,两个类是不能实现的。我原来做的类似你说的,把有用的给你写出来了。大概这个意思,简单明了,希望你能看懂
T_Module 目录表;T_Role 角色表; ACL 权限表(一个角色可以看到多个目录,一个目录可以被多个目录看到)
**Class Module
class Module {
private int id;
private String name;
private String url;
private int orderNo;
private String sn;
//getter and setter
**Class ROLE
class Role {
private int id;
private String name;
//getter and setter
**Class ACL
class ACL{
private int id;
private String principalType;
private int principalId;
private int moduleId;
private int aclState;
//setter and getter
** moduleXML
<id name="id">
<generator class="native"/>
</id>
<property name="name"/>
<property name="url"/>
<property name="orderNo"/>
<property name="sn"/>
** RoleXML
<id name="id">
<generator class="native"/>
</id>
<property name="name"/>
** ACLXML
<id name="id">
<generator class="native"/>
</id>
<property name="principalType"/>
<property name="principalId"/>
<property name="moduleId"/>
<property name="aclState"/>
T_Module 目录表;T_Role 角色表; ACL 权限表(一个角色可以看到多个目录,一个目录可以被多个目录看到)
**Class Module
class Module {
private int id;
private String name;
private String url;
private int orderNo;
private String sn;
//getter and setter
**Class ROLE
class Role {
private int id;
private String name;
//getter and setter
**Class ACL
class ACL{
private int id;
private String principalType;
private int principalId;
private int moduleId;
private int aclState;
//setter and getter
** moduleXML
<id name="id">
<generator class="native"/>
</id>
<property name="name"/>
<property name="url"/>
<property name="orderNo"/>
<property name="sn"/>
** RoleXML
<id name="id">
<generator class="native"/>
</id>
<property name="name"/>
** ACLXML
<id name="id">
<generator class="native"/>
</id>
<property name="principalType"/>
<property name="principalId"/>
<property name="moduleId"/>
<property name="aclState"/>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询