Quote:
My question would be, all the operations that I am doing are disconnected from hibernate. Meaning I am doing all these operations on the service layer objects. How would hibernate know that a fact was removed?
At some point your data-modifying code has to exist within a session, and be surrounded by a transaction. No DB modification will occur unless these 2 things happen.
In a managed environment (I use Spring), spring surrounds my methods with "interceptors" that create a transaction if none available, and keep the session alive between HTTP calls.
I don't know the topology of your project, or whether you are using hibernate or not, but getting this configured right is normally a big issue. (Then, you just copy it from one project to the next).
Since you are talking about working "disconnected" from a session, at some point you will have to have a real session respecting the above 2 conditions, and link your disconnected object with "session.update(obj)" or some other command.
Quote:
Would it make sense to make the association bi-directional? And when I am removing the fact from the collection set the parent id to be null? and that way it will be removed by delete-orphan attribute specified?
No, you should make the association bidirectional only if there is a business need for that, but it per se will not solve your persistence problem.