mysql - 从 Netbeans 中的 mysql 数据库自动生成的实体始终无法部署

标签 mysql jpa-2.0 netbeans-7

我是 Java EE(和 Netbeans)的新手。我试图从我的 mysql 数据库自动生成实体类...对于简单的关系,它可以工作,但对于以下关系,它总是失败:

enter image description here

我收到以下错误:

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/

相关文章:

java - 规范中是否可以使用非实体字段?

php - 如何让 Zend Studio 像 NetBeans 7.1 那样格式化 PHP 代码?

windows-7 - NetBeans Development 7 - Windows 7 64 位……JNI 原生调用……一个如何指导

php - 与 redbeanphp 的交集

SpringPersistenceUnitInfo::AbstractMethodError

oracle - JPA/标准 API - NotLike

java - NoClassDefFound错误: L => "L" added to import path by 'system' creates error

php - MySQL 查询返回所有事件及其照片

mysql - 如何在 Drupal 7 中将术语从一个词汇表移动到另一个词汇表而不丢失节点引用?

Mysql 总和与排序