public class Festival {
// 节日Id
@DozerProperty(myField = "festivalId", beforeField = "festivalId")
private Long festivalId;
// 版本号
@DozerProperty(myField = "version", beforeField = "version")
private Long version;
// 节日名称
private String festivalName;
// 备注
private String festivalNote;
// 节日对应休假集合
@DozerInfoSet(dozerProperty = { @DozerProperty(myField = "holidays", beforeField = "holidays") })
private List<Holiday> holidays = new ArrayList<Holiday>();
// 节日对应串休日集合
@DozerInfoSet(dozerProperty = { @DozerProperty(myField = "weekendOfWorks", beforeField = "weekendOfWorks") })
private List<WeekendOfWork> weekendOfWorks = new ArrayList<WeekendOfWork>();
------------------------------------------------
public class Holiday {
// 节假日id
@DozerProperty(myField = "holidayId", beforeField = "holidayId")
private Long holidayId;
// 假期日期
private Date holidayDate;
----------------------------------------------------
public class WeekendOfWork {
// 串休日id
@DozerProperty(myField = "weekendOfWorkId", beforeField = "weekendOfWorkId")
private Long weekendOfWorkId;
// 串休日时间
private Date weekendOfWorkDate;
-----------------------------------------------------
<bag name="holidays" inverse="false" cascade="all-delete-orphan" >
<key>
<column name="FESTIVALID" />
</key>
<one-to-many class="com.gosophia.holidayManagement.entity.Holiday" />
</bag>
<bag name="weekendOfWorks" inverse="false" cascade="all-delete-orphan">
<key>
<column name="FESTIVALID" />
</key>
<one-to-many class="com.gosophia.holidayManagement.entity.WeekendOfWork" />
</bag>
这是两个实体都有hbm的映射文件
===================================================
下面是值对象的配置方式
<bag name="launchAnnexs" cascade="all" inverse="false" table="T_REPORTDATA_LAUNCHANNEX">
<key column="LAUNCHREPORTID"></key>
<composite-element class="LaunchAnnex" >
<property name="fileName" column="ANNEXNAME" length="512" ></property>
<property name="fileNote" column="FILENOTE" length="512"></property>
<property name="filePath" column="FILEPATH" length="512"></property>
</composite-element>
</bag>
LaunchAnnex是没有映射文件的。
// 节日Id
@DozerProperty(myField = "festivalId", beforeField = "festivalId")
private Long festivalId;
// 版本号
@DozerProperty(myField = "version", beforeField = "version")
private Long version;
// 节日名称
private String festivalName;
// 备注
private String festivalNote;
// 节日对应休假集合
@DozerInfoSet(dozerProperty = { @DozerProperty(myField = "holidays", beforeField = "holidays") })
private List<Holiday> holidays = new ArrayList<Holiday>();
// 节日对应串休日集合
@DozerInfoSet(dozerProperty = { @DozerProperty(myField = "weekendOfWorks", beforeField = "weekendOfWorks") })
private List<WeekendOfWork> weekendOfWorks = new ArrayList<WeekendOfWork>();
------------------------------------------------
public class Holiday {
// 节假日id
@DozerProperty(myField = "holidayId", beforeField = "holidayId")
private Long holidayId;
// 假期日期
private Date holidayDate;
----------------------------------------------------
public class WeekendOfWork {
// 串休日id
@DozerProperty(myField = "weekendOfWorkId", beforeField = "weekendOfWorkId")
private Long weekendOfWorkId;
// 串休日时间
private Date weekendOfWorkDate;
-----------------------------------------------------
<bag name="holidays" inverse="false" cascade="all-delete-orphan" >
<key>
<column name="FESTIVALID" />
</key>
<one-to-many class="com.gosophia.holidayManagement.entity.Holiday" />
</bag>
<bag name="weekendOfWorks" inverse="false" cascade="all-delete-orphan">
<key>
<column name="FESTIVALID" />
</key>
<one-to-many class="com.gosophia.holidayManagement.entity.WeekendOfWork" />
</bag>
这是两个实体都有hbm的映射文件
===================================================
下面是值对象的配置方式
<bag name="launchAnnexs" cascade="all" inverse="false" table="T_REPORTDATA_LAUNCHANNEX">
<key column="LAUNCHREPORTID"></key>
<composite-element class="LaunchAnnex" >
<property name="fileName" column="ANNEXNAME" length="512" ></property>
<property name="fileNote" column="FILENOTE" length="512"></property>
<property name="filePath" column="FILEPATH" length="512"></property>
</composite-element>
</bag>
LaunchAnnex是没有映射文件的。