aspose file tools*
The moose likes Object Relational Mapping and the fly likes when parent is deleted child is updating rather than deleting Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "when parent is deleted child is updating rather than deleting" Watch "when parent is deleted child is updating rather than deleting" New topic
Author

when parent is deleted child is updating rather than deleting

ankur jadiya
Greenhorn

Joined: Feb 15, 2013
Posts: 4
This problem is related to hibenate and this is my first time to ask the question in this forum if any mistakes on asking question please tell me so that i can improve style of asking question thanks.
My problem is that when i am performing delete operation on parent table parent is deleted smoothly but in child table, update query is running.There is one-to-many relation exist in parent and child table
where Employee Table is parent and Project table is child table
when executing the program output is showing like this

output

Hibernate: update employee_project set employeeNumber=null where employeeNumber=?
Hibernate: delete from employee where EMPLOYEE_NUMBER=?



Employee pojo

}
and this is my Employee.hbm.xml



and this is my project.hbm.xml




and the logic is
of deleting is

Anayonkar Shivalkar
Bartender

Joined: Dec 08, 2010
Posts: 1512
    
    5

Hi ankur,

Welcome to CodeRanch!

Firstly, please go through forum FAQs (like TellTheDetails, CarefullyChooseOneForum, UseCodeTags etc.).

Further, please be clear about exactly when you are having problem. What is parent table and child table? What is Employee.hbm.xml?

To me, the question appears to be related to hibernate (would be much better if you mention this) and I'm moving this to relevant forum.

Please provide the details (so that other members can assist you in better way) and feel free to ask more questions (and answer questions by others ).


Regards,
Anayonkar Shivalkar (SCJP, SCWCD, OCMJD, OCEEJBD)
ankur jadiya
Greenhorn

Joined: Feb 15, 2013
Posts: 4
ankur wrote:Hi Anayonkar Shivalkar,

Thanks for replying as you know this is my first time can you tell if question related to particular topic how to ask question on that topic forum
Anayonkar Shivalkar
Bartender

Joined: Dec 08, 2010
Posts: 1512
    
    5

Its ok

You can check forum's home page and select proper forum.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: when parent is deleted child is updating rather than deleting