Hibernate - 实体类配置
配置文件
<?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.ztes.modules.house.House" table="tb_house" catalog="build"> <id name="houseId" type="java.lang.String"> <column name="house_id" length="32" /> <generator class="uuid.hex" /> </id> <many-to-one name="projectId" class="com.ztes.modules.Project" lazy="false"> <column name="project_id" length="32"> <comment>关联项目ID</comment> </column> </many-to-one> </class> </hibernate-mapping>
实体类
package com.ztes.modules.house; import org.apache.struts2.json.annotations.JSON; import com.ztes.modules.project.Project; /** * TbHouse entity. * * @author MyEclipse Persistence Tools */ public class House implements java.io.Serializable { // Fields private String houseId;// private Project projectId;// 所属项目 /** default constructor */ public House() { } public String getHouseId() { return this.houseId; } public void setHouseId(String houseId) { this.houseId = houseId; } @JSON(serialize = false) public Project getProjectId() { return projectId; } public void setProjectId(Project projectId) { this.projectId = projectId; } }
本文出自 “Zero的技术之路” 博客,请务必保留此出处http://zerohou.blog.51cto.com/3019528/1615174
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。