• Post Reply Bookmark Topic Watch Topic
  • New Topic

Delete query also getting called along with select query on user entity

 
srikanth Thandra
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am observing that delete query on user_skills table is also getting called along with user select query.
Actually there are two entities User and Skill. There is a ManyToMany relationship between these two entities with a join table USER_SKILLS. Below are the class defintions:





I was able to save User with  many skills into database and when I try to get the saved user info from database then delete query on user_skills table is also getting fired and the data is getting deleted from user_skills table. Below is the queries log:

Hibernate:
    User table query: select this_.id as id1_2_0_,this_.first_name as first_na8_2_0_,this_.last_name as last_na11_2_0_ from user user0_  where user0_.id=?
   
    User_Skills table query: select userskills0_.id as id1_2_0_,userskills0_.skill_id as skill_id2_4_0_,skill1_.skill_id as skill_id1_0_1_,skill1_.name as name2_0_1_  from  user_skills userskills0_ inner join skill skill1_ on userskills0_.skill_id=skill1_.skill_id
                                           where userskills0_.id=?


    User_Skills delete query: delete from user_skills where id=?

Why this delete query is getting called I am not getting? Is this expected in hibernate? Can some one please help me on this?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!