[英]mapping a composite key with hibernate
I'm trying to map one to many relationship using Hibernate : 我正在尝试使用Hibernate映射一对多关系:
I have a profil with multiple properties: 我有多个属性的配置文件:
Profil.java 配置文件
public class Profil {
private String idProfil;
private String name;
private Set<Properties> setProperties;
}
Properties.java Properties.java
public class Properties {
private CompositeId id;
private String length;
private String heigth;
private String width;
}
and a compositeId.java 和一个compositeId.java
public class CompositeId {
private String idPropertiy;
private String idProfil;//idProfil is a foreign key
}
idProperty is assigned manually. idProperty是手动分配的。
idProfil is assigned automatically. idProfil是自动分配的。
can anyone help me to write the hbm.xml files. 谁能帮我写hbm.xml文件。
You can use Hibernate Synchronizer Eclipse plugin to generate the *.hbm files and its associated java classes. 您可以使用Hibernate Synchronizer Eclipse插件来生成* .hbm文件及其关联的Java类。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.