I am not sure if this will work but you can try the following approach and let us know.
when i delete the parent ,child should not be deleted
@OneToMany(fetch = FetchType.EAGER,
orphanRemoval=false)
use of
updatable=false looks correct to me
i delete the parent ....one of the child column department_ID which is foreign key must be update with some value
This seems to be specific to Delete Event. I assume when relationship is deleted, in the entity Department, Collection<Employee>
employeeList is set to null
You may define an even listener for delete action here. More description about event
here
Implement
PreCollectionRemoveEventListener and add it to your
Configuration
In the listener method onPreRemoveCollection(
PreCollectionRemoveEvent event)
1. create PreCollectionRemoveEvent pass the collection employeeList in constructor,
2. for each Employee in Collection<Employee> employeeList
set DEPARTMENT_ID = <default_value>
save employee
If PreCollectionRemoveEvent doesn't work, you may try PreCollectionUpdateEvent