配置文件
<?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; } }
时间: 2024-10-24 06:11:20