You do not have to change an ID by yourself. The hibernate will do it.
You can use the cascade on your mapping (@OneTo....).
If you have an relationship bidirectional you will need to point eachother like
a.setB(b);
b.setA(a);
I wrote an post about it. I hope it might help you:
JPA @OneToOne Unidirectional and Bidirectional