• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Foreign Key null value and Hibernate error

 
Sethu Nambiar
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a situation to insert null value in the foreign key column. Oracle allows to do that but while doing this using hibernate it throws error as follows.

"Records Cannot be Added or Updated or Deleted UNIQUE KEY CONSTRAINT"

Could some one please let me know how to resolve this?

Thanks
Sethu
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Sethu"

Welcome to JavaRanch!

Can you please change your display name so it complies with our Naming Policy? You can do this here.

Thanks!
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please post your mapping. By default relationships mapping make the FK field to be required, not-null="true".

Mark
 
Sethu Nambiar
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mark,
thanks for your reply. Yes I was using the default mapping and the not-null attribute is set to true. I'll change it to false.

Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic