package com.scm.domain;
import java.util.HashSet;
import java.util.Set;
/**
* SysBumen entity.
*
* @author MyEclipse Persistence Tools
*/
public class SysBumen implements java.io.Serializable {
// Fields
private Integer id;
private String bumenmingcheng;
private String miaoshu;
private Integer zhuangtai;
private Set sysYuangongs = new HashSet(0);
private Set sysJueses = new HashSet(0);
// Constructors
/** default constructor */
public SysBumen() {
}
/** minimal constructor */
public SysBumen(String bumenmingcheng) {
this.bumenmingcheng = bumenmingcheng;
}
/** full constructor */
public SysBumen(String bumenmingcheng, String miaoshu, Integer zhuangtai,
Set sysYuangongs, Set sysJueses) {
this.bumenmingcheng = bumenmingcheng;
this.miaoshu = miaoshu;
this.zhuangtai = zhuangtai;
this.sysYuangongs = sysYuangongs;
this.sysJueses = sysJueses;
}
// Property accessors
public Integer getId() {
return this.id;
}
public void setId(Integer id) {
this.id = id;
}
public String getBumenmingcheng() {
return this.bumenmingcheng;
}
public void setBumenmingcheng(String bumenmingcheng) {
this.bumenmingcheng = bumenmingcheng;
}
public String getMiaoshu() {
return this.miaoshu;
}
public void setMiaoshu(String miaoshu) {
this.miaoshu = miaoshu;
}
public Integer getZhuangtai() {
return this.zhuangtai;
}
public void setZhuangtai(Integer zhuangtai) {
this.zhuangtai = zhuangtai;
}
public Set getSysYuangongs() {
return this.sysYuangongs;
}
public void setSysYuangongs(Set sysYuangongs) {
this.sysYuangongs = sysYuangongs;
}
public Set getSysJueses() {
return this.sysJueses;
}
public void setSysJueses(Set sysJueses) {
this.sysJueses = sysJueses;
}
}
SysBumen.hbm.xml
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!--
Mapping file autogenerated by MyEclipse Persistence Tools
-->
<hibernate-mapping>
<class name="com.scm.domain.SysBumen" table="sys_bumen" catalog="scm" lazy="false">
<id name="id" type="java.lang.Integer">
<column name="id" />
<generator class="native" />
</id>
<property name="bumenmingcheng" type="java.lang.String">
<column name="bumenmingcheng" length="50" not-null="true" />
</property>
<property name="miaoshu" type="java.lang.String">
<column name="miaoshu" length="1000" />
</property>
<property name="zhuangtai" type="java.lang.Integer">
<column name="zhuangtai" />
</property>
<set name="sysYuangongs" inverse="true">
<key>
<column name="sys_id" />
</key>
<one-to-many class="com.scm.domain.SysYuangong" />
</set>
<!-- 关键是这里的inverse需要设成false,cascade设成关联的级别 -->
<set name="sysJueses" inverse="false" table="sys_bumenjuese" catalog="scm" lazy="false" cascade="save-update,delete">
<key>
<column name="bumen_id" not-null="true" />
</key>
<many-to-many entity-name="com.scm.domain.SysJuese">
<column name="sys_id" not-null="true" />
</many-to-many>
</set>
</class>
</hibernate-mapping>
SysJuese.java
package com.scm.domain;
import java.util.HashSet;
import java.util.Set;
/**
* SysJuese entity.
*
* @author MyEclipse Persistence Tools
*/
public class SysJuese implements java.io.Serializable {
// Fields
private Integer id;
private String juesemingcheng;
private String miaoshu;
private Integer zhuangtai;
private Set sysBumens = new HashSet(0);
private Set sysYonghus = new HashSet(0);
private Set sysQuanxians = new HashSet(0);
// Constructors
/** default constructor */
public SysJuese() {
}
/** minimal constructor */
public SysJuese(String juesemingcheng) {
this.juesemingcheng = juesemingcheng;
}
/** full constructor */
public SysJuese(String juesemingcheng, String miaoshu, Integer zhuangtai,
Set sysBumens, Set sysYonghus, Set sysQuanxians) {
this.juesemingcheng = juesemingcheng;
this.miaoshu = miaoshu;
this.zhuangtai = zhuangtai;
this.sysBumens = sysBumens;
this.sysYonghus = sysYonghus;
this.sysQuanxians = sysQuanxians;
}
// Property accessors
public Integer getId() {
return this.id;
}
public void setId(Integer id) {
this.id = id;
}
public String getJuesemingcheng() {
return this.juesemingcheng;
}
public void setJuesemingcheng(String juesemingcheng) {
this.juesemingcheng = juesemingcheng;
}
public String getMiaoshu() {
return this.miaoshu;
}
public void setMiaoshu(String miaoshu) {
this.miaoshu = miaoshu;
}
public Integer getZhuangtai() {
return this.zhuangtai;
}
public void setZhuangtai(Integer zhuangtai) {
this.zhuangtai = zhuangtai;
}
public Set getSysBumens() {
return this.sysBumens;
}
public void setSysBumens(Set sysBumens) {
this.sysBumens = sysBumens;
}
public Set getSysYonghus() {
return this.sysYonghus;
}
public void setSysYonghus(Set sysYonghus) {
this.sysYonghus = sysYonghus;
}
public Set getSysQuanxians() {
return this.sysQuanxians;
}
public void setSysQuanxians(Set sysQuanxians) {
this.sysQuanxians = sysQuanxians;
}
}
SysJuese.hbm.xml