I have a requirement in which I have to save one object graph to db1, get the Ids of all objects in the object graph from this database, and save the object graph with Ids in db2(read it as database number 2, not db2, literally). The requirement is that both databases should have the same data. One more constraint is that both of these databases are same and they use sequence on each table. I have been trying different generator strategies but nothing is working for me. For example, I tried to set sequence generator in mapping file, when I save in 1st db, it works fine and I get the Ids but when I try to set this id to the object and try to save in the db2, I get different Ids returned from db2.
|