JPA无法解析列/ IntelliJ [英] JPA Cannot resolve column/IntelliJ
问题描述
我正在尝试使用Hibernate JPA实现映射一些Java类。我的问题是我不能使用硬编码的Strings als列名。您可以在下面的图片中看到我收到的错误消息。
I'm trying to map some Java classes using the Hibernate JPA implementation. My problem is that I can't use hardcoded Strings als column namens. You can see the error message I get in the picture below.
我正在使用OpenJPA作为我的默认JPA提供程序,并且已经尝试更改它。
I'm using OpenJPA as my Default JPA Provider and have already tried to change it.
IntelliJ版本14.0.3
IntelliJ Version 14.0.3
问候,
推荐答案
您必须将数据源(首先在数据库视图中创建数据源 - 也就是真正的JDBC数据库连接)与持久性单元或会话工厂(hibernate.cfg.xml)相关联。
You have to associate your data source (create a data source in database view first - aka your real JDBC database connection) with a persistence unit or session factory (hibernate.cfg.xml).
按照以下步骤操作,警告将消失:
Follow below steps and the warnings will disappear:
- 打开持久性工具窗口(查看|工具窗口|
持久性)。 - 右键单击必要的模块,持久性单元或
会话工厂,然后在上下文菜单中选择分配数据源。 - In打开的分配数据源对话框,单击数据源
字段并选择所需的数据源。 (要删除与数据源的
关联,请选择。)
请参见此处:将数据源与会话工厂和持久性单元相关联
这篇关于JPA无法解析列/ IntelliJ的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!