Hibernate用空值映射组合键 [英] Hibernate mapping a composite key with null values
本文介绍了Hibernate用空值映射组合键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是为了处理遗留问题表中有一个唯一的键,可以有空值,但没有主键。
我意识到我可以添加一个新的主键列到表中,我想知道是否有办法避免这样做。
解决方案
不。主键不能为空。
With Hibernate, can you create a composite ID where one of the columns you are mapping to the ID can have null values?
This is to deal with a legacy table that has a unique key which can have null values but no primary key.
I realise that I could just add a new primary key column to the table, but I'm wondering if there's any way to avoid doing this.
解决方案
No. Primary keys can not be null.
这篇关于Hibernate用空值映射组合键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文