I have an application A with a domain-model which is mapped to a database using Hibernate. I have another application B that uses exactly the same domain-model-classes as A and adds some additional classes.
My goal is to read data from database A in application B and transfer that data into the database of B (to make a copy of it). In addition, some the domain-classes of B have associations (OneToOne) to domain-classes of A (but in the database of B, of course).
What's the best strategy to accomplish this? I thought of two session factories and using Session.replicate()
(how does that work?). Or should I better introduce an additional mapping layer between these two domain-models for loose coupling?