我有一个表DDL可能会在外部更改的情况,JPA因此希望在尝试保留任何实体之前检测它。如果检测到这种差异,则应引发异常,并且错误消息应准确说明违规(例如point to the missing column, column of the wrong type/width or a missing foreign/unique key
)。
现在我正在使用Hibernate作为JPA provider. 我试图找到有关 的行为的文档,org.hibernate.cfg.Configuration.validateSchema但JavaDoc.
谁能举例说明如何做到这一点 - 无论是与其他提供商一起Hibernate还是与任何其他JPA提供商一起?