It is a good idea to make sure that both ends of the association are up-to-date. Having this code in a single method is also a good idea. However it may not be a good idea to put this code in in the setParent() method since, as you point, Hibernate is also calling the setParent() method. This will trigger all sorts of things (lazy loading of the parent and it's children collection for example) which you may not want to happen.
The Hibernate documentation has an example (
http://www.hibernate.org/hib_docs/v3/re ... child.html)
where this is done from the parent side with methods that are not called by Hibernate.