- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我试图通过 hibernate 中的 JoinTable 进行单向 ManyToOne 关联,但我不断收到以下错误:
A JPA error occurred (Unable to build EntityManagerFactory): Unable to find column with logical name: name in org.hibernate.mapping.Table(users) and its related supertables and secondary tables
我有 3 个模型 House
、User
、UserHouseMap
。我希望能够通过 UserHouseMap
访问用户之家。这是 User
由于其他原因,我需要通过非主键的列将 User
映射到 UserHouseMap
@Id
@GeneratedValue
@Expose
public Long id;
@Expose
@Required
@ManyToOne
@JoinTable(name = "user_house_map",
joinColumns= {@JoinColumn(table="users", name="user_name", referencedColumnName="name")},
inverseJoinColumns={@JoinColumn(table="houses", name="house_name", referencedColumnName="house_name")})
public House house;
以下是所有 3 个模型的数据库架构
用户
Table "public.users"
Column | Type | Modifiers
-----------------------+-----------------------------+-----------------------------
name | character varying(255) |
id | integer | not null
Indexes:
"user_pkey" PRIMARY KEY, btree (id)
Foreign-key constraints:
"housing_fkey" FOREIGN KEY (name) REFERENCES user_house_map(user_name) DEFERRABLE INITIALLY DEFERRED
房屋
Table "public.houses"
Column | Type | Modifiers
---------------+------------------------+-----------
house_name | character varying(255) | not null
address | text |
city | text |
state | text |
zip | integer |
zip_ext | integer |
phone | text |
Indexes:
"house_pkey" PRIMARY KEY, btree (house_name)
Referenced by:
TABLE "user_house_map" CONSTRAINT "house_map_fkey" FOREIGN KEY (house_name) REFERENCES house(house_name) DEFERRABLE INITIALLY DEFERRED
UserHouseMap
Table "public.user_house_map"
Column | Type | Modifiers
-------------+------------------------+-----------
user_name | character varying(255) | not null
house_name | character varying(255) | not null
Indexes:
"user_house_map_pkey" PRIMARY KEY, btree (user_name)
"user_house_map_house_key" btree (house_name)
Foreign-key constraints:
"user_house_map_house_fkey" FOREIGN KEY (house_name) REFERENCES houses(house_name) DEFERRABLE INITIALLY DEFERRED
Referenced by:
TABLE "users" CONSTRAINT "housing_fkey" FOREIGN KEY (name) REFERENCES user_house_map(user_name) DEFERRABLE INITIALLY DEFERRED
最佳答案
从 JoinColumn
注释中删除 table="users"
和 table="houses"
。
该属性不应包含外键的目标表。仅当实体映射到两个表时才使用它,以便判断连接列位于哪个表中。
此外,你的表定义很奇怪:
关于java - Hibernate连接表错误: Unable to find column with logical name,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29528596/
Closed. This question is opinion-based。它当前不接受答案。 想改善这个问题吗?更新问题,以便editing this post用事实和引用来回答。 上个月关闭。
我正在 VHDL 中实现正交解码器,并提出了两种解决方案。 在方法 1 中,所有逻辑都放在一个对时钟和复位敏感的进程中。 在 Spartan-3A 上,这使用四个切片、七个 FF 和四个输入 LUT。
我现在在我的项目中使用 Logic-Apps。我认为这很好而且很容易!但是,在逻辑编码过程中很难调试。因为我无法在代码的中间点确认变量或状态。通常,开发人员可以在 Visual Studio 上执行程
我试图让一个方法仅在 unicode 字符的 char 值是数字、大写字母或小写字母时才采取操作。 if ((48=57)||(65=90)||(97=122) // only if numeral
所以我得到了我编写的代码示例。我的目标是打印存储在 ptr char 变量中的句子中的数字。所以代码的第一部分完成了这项工作。 #include #include void preg(char *
我有很多 JavaScript 遗留代码,我想重写所有松散的等式以使用严格的等式,即。 == 与 ===。但我常常不知道比较变量存储的是什么值。 在不知道这些值是什么的情况下,有没有办法重写这样的东西
我在尝试附加包 tidyselect 和尝试调用 tidyselect::any_function 时遇到此错误。 错误发生在 Rstudio 或类似的命令行中,在 RStudio 中它会在我输入时立
有什么方法可以在调用子逻辑应用时动态更新工作流: 正常工作流程配置如下: 我想要实现的目标如下,使用属性、变量任何更新运行时的工作流程,我尝试使用如下: 当我尝试按上述方式保存时,结果为错误:保存失败
有什么方法可以在调用子逻辑应用时动态更新工作流: 正常工作流程配置如下: 我想要实现的目标如下,使用属性、变量任何更新运行时的工作流程,我尝试使用如下: 当我尝试按上述方式保存时,结果为错误:保存失败
例如,考虑逻辑“用户只能编辑或删除该用户发表的评论”。 My Controller Actions会重复检查当前登录用户是否可以影响评论的逻辑。示例 [Authorize] public Action
在基于规则的专家系统中,知识库包含大量“if (template) then (action)”形式的规则。推理引擎选择与输入事实相匹配的规则。即那些条件部分与输入数据相匹配的规则被列入候选名单,并选
谁能解释一下这个分离逻辑的例子? 第一行和第二行有什么区别? 最佳答案 第一行说堆只包含一个小堆,因此存储中的引用 x 指向它,并且它包含值 4,4。 在 A 中为假,因为它忘记了 y 指向的小堆(它
我尝试了几天编写 NLTK 语法来将简单的法语句子转换为逻辑公式。我的问题可能与英语句子相似。我的目标是这个语法接受多个订单(家庭自动化)并将它们转换为逻辑公式。一些订单示例: 开灯: exists
我正在大学/学院学习自然演绎,作为我正式规范和验证计算机科学类(class)的一部分。 我觉得这很有趣,但是当我找到实际用途时,我会学得更好。 谁能向我解释除了用于正式验证代码位之外是否以及如何使用自
Closed. This question does not meet Stack Overflow guidelines。它当前不接受答案。 想改善这个问题吗?更新问题,以便将其作为on-topic
物理量子位和逻辑量子位有什么区别? 我希望有人能帮助我解决这个问题,我无法弄清楚到底有什么区别。 最好的,迪尔玛 最佳答案 逻辑量子位是可以用于编程的,它保存了 |0> 和 |1> 状态的叠加。它可以
我正在尝试学习如何使用 C++ 修改内存位置,并且在使用 MineSweeper 时,我注意到当内存中的时钟值为 1101004800 时,游戏进入了 20 秒。数字 1101529088 对应于游戏
关闭。这个问题是off-topic .它目前不接受答案。 想改进这个问题吗? Update the question所以它是on-topic用于堆栈溢出。 关闭 11 年前。 Improve thi
首先介绍一些术语(取自here,第14页): 正程序是有错误的程序。 否定程序是没有错误的程序。 因此,程序有四种类型: 积极计划,分析为积极->真正积极(TP)。 积极计划,分析为否定->假否定(F
任何人都可以推荐可用于评估逻辑表达式的软件(最好是mac)或基于网络的工具吗? 例如,我希望能够快速测试两个表达式是否如下: $a = 'foo'; $b = 'bar'; $c = 'foo'; (
我是一名优秀的程序员,十分优秀!