class Resume {
private int id;
private ResumeLangInfo enResumeInfo //对应resume_lang_info的一条数据 条件是ResumeLangInfoPK 的id与这个实体的id相等 并language = en;
private ResumeLangInfo zhResumeInfo //对应resume_lang_info的一条数据 条件是ResumeLangInfoPK 的id与这个实体的id相等 并language = zh;
}private ResumeLangInfo {
private ResumeLangInfoPK pk;
//后面是语言相关的数据
}private ResumeLangInfoPK{
private int resumeid;
private String language;
}resume
id int
后面有很多String的字段 没什么关系resume_lang_info
resumeid int 这个字段是参考 resume.id的
language String "zh" "en"
这样是不是没有办法写这样的映射
一个类里有两个属性是指到同一个表的不同数据
private int id;
private ResumeLangInfo enResumeInfo //对应resume_lang_info的一条数据 条件是ResumeLangInfoPK 的id与这个实体的id相等 并language = en;
private ResumeLangInfo zhResumeInfo //对应resume_lang_info的一条数据 条件是ResumeLangInfoPK 的id与这个实体的id相等 并language = zh;
}private ResumeLangInfo {
private ResumeLangInfoPK pk;
//后面是语言相关的数据
}private ResumeLangInfoPK{
private int resumeid;
private String language;
}resume
id int
后面有很多String的字段 没什么关系resume_lang_info
resumeid int 这个字段是参考 resume.id的
language String "zh" "en"
这样是不是没有办法写这样的映射
一个类里有两个属性是指到同一个表的不同数据
解决方案 »
- My97日期控件中在input中如何显示当前时间
- Java Xfire WebSerivce 服务端调用返回Blob对象的接口错误
- 请问MYSQL 使用连接池功能应如何设置 DRIVERCLASS
- 请教Spring的AOP的问题!
- hibernate 报错:argument type mismatch
- 请问如何进行可持续发展?
- 困扰我很久了啊~~jwsdp Registry Server的问题!!
- 【原创】Hibernate的缓存机制介绍
- JNative怎么样获取指针中的值?
- ant 命令出现的问题!
- session bean 的local接口的錯誤調試
- linux+jdk+tomcat+sqlserver
分别定义3个类对应以下3个配置文件:
<hibernate-mapping>
<class name="org.tinna.resume" table="RESUME">
<id name="resumeId" type="java.lang.Integer">
<column name="resumeid" />
<generator class="assigned" />
</id>
<one-to-one name="enResumeInfo" class="org.tinna.enResumeInfo" cascade="all"></one-to-one>
<one-to-one name="zhResumeInfo" class="org.tinna.zhResumeInfo" cascade="all"></one-to-one>
</class>
</hibernate-mapping>
<hibernate-mapping>
<class name="org.tinna.enResumeInfo" table="RESUME">
<id name="resumeId" type="java.lang.Integer">
<column name="resumeid" />
<generator class="assigned" />
</id>
<property name="enname" type="java.lang.String">
<column name="enname" />
</property>
<property name="ensex" type="java.lang.String">
<column name="ensex" />
</property>
<one-to-one name="resume" class="org.tinna.resume"></one-to-one>
</class>
</hibernate-mapping><hibernate-mapping>
<class name="org.tinna.zhResumeInfo" table="RESUME">
<id name="resumeId" type="java.lang.Integer">
<column name="resumeid" />
<generator class="assigned" />
</id>
<property name="zhname" type="java.lang.String">
<column name="zhname" />
</property>
<property name="zhsex" type="java.lang.String">
<column name="zhsex" />
</property>
<one-to-one name="resume" class="org.tinna.resume"></one-to-one>
</class>
</hibernate-mapping>