Hibernate 奇怪“ORA-01400: 无法将 NULL 插入”错误
我发生了一个奇怪的错误。我正在使用 Hibernate,我映射了一个名为 Widget 的类,它有一个 Parameter 类,但是当我尝试插入时,我得到了 “ORA-01400: 无法将 NULL 插入...”
映射正确完成如下:
<bag cascade="none" inverse="true" lazy="false" name="parameters" table="PARAMS" >
<key column="WIDGET_ID" foreign-key="FK_PARAMS" not-null="true"/>
<one-to-many class="Parameter"/>
</bag>
奇怪的是,非空属性设置为“true”,这强制插入 Widget 对象的 ID 值。
提前致谢
there is a strange error ocurring to me. I'm working with Hibernate, I have mapped class called Widget, which has a Parameter class, but when I try to insert I get
"ORA-01400: cannot insert NULL into..."
The mapping is properly done as:
<bag cascade="none" inverse="true" lazy="false" name="parameters" table="PARAMS" >
<key column="WIDGET_ID" foreign-key="FK_PARAMS" not-null="true"/>
<one-to-many class="Parameter"/>
</bag>
The wierd thing is that the not-null property is setted to "true" which forces to insert the ID value of the Widget Object.
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你解决问题了吗?我想我有同样的问题
ORA-01400 :无法将 null 插入 (TABLE.COLUMN) (Hibernate)
在我的例子中,我解决了修改 Db,使外键也成为主键
Did you solved the problem? I think I had the same problem
ORA-01400: Cannot insert null into (TABLE.COLUMN) (Hibernate)
In my case I solved modifying Db, making foreign keys also primary keys