• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Key is not present in table error hibernate

 
zabet tyan
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I am trying to save something into database, but i am getting this error:




What I don't understand is that the values delivery_restriction_id = 62 delivery_type_id = 343 are clearly present from this line:

Batch entry 0 insert into public.del_res_del_type_xref (delivery_restriction_id, delivery_type_id) values (62, 343) was aborted

but why does hibernate complain that key is not present. I look in both tables (delivery_restriction and delivery_type) and the id's are there.

Here's del_res_del_type_xref's script


any ideas?

 
Reehan Lalkhanwar
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The error only says that delivery_restriction_id = 62 is not present in delivery_restriction table.
Did you check the DB? Did you run the query on delivery_restriction for id=62 and did you get any results?
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
iririr zz, please check your private messages.
 
zabet tyan
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Yes it's there, if I run this sql command manually it works fine:




That's what surprises me.

Thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64959
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"iririr zz", please check your private messages for an important administrative matter. Failure to do so will result in the removal of your account.
 
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm wondering what the primary key is for this table?

-Cameron McKenzie
 
zabet tyan
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok solved the problem. apparently one of my other hbm files were mapping to this table as well and it didn't like the changes when they came from the original table.

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