如何在没有主键的情况下为表或视图进行hibernate映射 [英] how to do hibernate mapping for table or view without a primary key
本文介绍了如何在没有主键的情况下为表或视图进行hibernate映射的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
可能存在重复:
Hibernate并没有PK
任何人都知道如何做hibernate mapping for表或视图没有主键?解析方案
不要认为Hibernate允许映射没有主键的表......思考关于Hibernate如何在没有可以唯一标识一行的列的情况下执行更新。
我想解决方法是将复合键与所有列一起使用,但是您添加主键会更好。
Possible Duplicate:
Hibernate and no PK
Anyone knows how to do hibernate mapping for table or view without a primary key?
解决方案
Don't think Hibernate allows mapping a table without a primary key...think about how Hibernate would perform updates without a column that can uniquely identify a row.
I guess a work-around would be to use a composite key with all columns, but you are much better off adding a primary key.
这篇关于如何在没有主键的情况下为表或视图进行hibernate映射的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文