[英]EclipseLink DDL Generation ERROR
I cannot generate DDL by using EclipseLink
, when an Embeddable
class have another Entity
O/R mapping annotation. 当
Embeddable
类具有另一个Entity
O / R映射注释时,无法使用EclipseLink
生成DDL。 How can I generate DDL for my O/R mapping? 如何为O / R映射生成DDL?
Company.java 公司.java
@Entity
public class Company implements Serializable {
.....
@Embedded
private CompanyAddress address;
}
CompanyAddress.java CompanyAddress.java
@Embeddable
public class CompanyAddress implements Serializable {
.....
@Embedded
@OneToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "TOWNSHIP_ID", referencedColumnName = "ID")
private Township township;
}
Township.java Township.java
@Entity
public class Township implements Serializable {
.....
}
When I generate I get the following error, 当我生成时,出现以下错误,
Exception [EclipseLink-195] (Eclipse Persistence Services - 2.1.2.v20101206-r8635): org.eclipse.persistence.exceptions.DescriptorException
Exception Description: The shared class org.ace.insurance.system.common.company.CompanyAddress must not reference the isolated class org.ace.insurance.system.common.township.Townsh
ip.
Mapping: org.eclipse.persistence.mappings.OneToOneMapping[township]
Descriptor: RelationalDescriptor(org.ace.insurance.system.common.company.CompanyAddress --> [DatabaseTable(COMPANY)])
If I understand you correctly you want Township to be a normal seperate entity. 如果我对您的理解正确,那么您希望Township成为正常的独立实体。 In that case you should remove the @Embedded annotation from the township field in CompanyAddress.
在这种情况下,您应该从CompanyAddress的乡镇字段中删除@Embedded注释。 If you want it to be embedded then Township will need an @Embeddable annotation instead of @Entity.
如果您希望将其嵌入,那么Township将需要一个@Embeddable注释而不是@Entity。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.