我是 Java EE(和 Netbeans)的新手。我试图从我的 mysql 数据库自动生成实体类...对于简单的关系,它可以工作,但对于以下关系,它总是失败:
我收到以下错误:
Internal Exception: Exception [EclipseLink-7220] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.ValidationException Exception Description: The @JoinColumns on the annotated element [field tblExpandituresTranx] from the entity class [class entities.restaurant.TblContents] is incomplete. When the source entity class uses a composite primary key, a @JoinColumn must be specified for each join column using the @JoinColumns. Both the name and the referencedColumnName elements must be specified in each such @JoinColumn.. Please see server.log for more details.
我想...我的数据库中有一些错误,或者 EclipseLink JPA 工具可能已失效! 请帮忙!
最佳答案
可能是您的架构颠倒了。
或者您实际上可以阅读收到的异常并弄清楚它告诉您什么:
The @JoinColumns on the annotated element [field tblExpandituresTranx] from the entity class [class entities.restaurant.TblContents] is incomplete. When the source entity class uses a composite primary key, a @JoinColumn must be specified for each join column using the @JoinColumns. Both the name and the referencedColumnName elements must be specified in each such @JoinColumn
看起来您的 JOIN 规范不完整。
关于mysql - 从 Netbeans 中的 mysql 数据库自动生成的实体始终无法部署,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14114984/