Hi Christian,

Christian Eugster wrote:

Maybe someone can help me.

I run two databases (both mysql) concurrently (one on a server, the other
locally to ensure, that the program may run, even the server is down). I
want the records of some tables to be identic on both databases (even their
primary keys).

Every table has a Long (BIGINT) id-field as a primary key. I use ojb's
sequencemanager (HighLowImpl). Has anybody an idea how I have to setup ojb
that i can insert a record with a given id, i.e. to insert an object in db1
first and then in db2 with the same primary key?


I'm sure don't understand the problem (aside from the distributed tx problem ;-)).
If you store the object with PB_DB1 then pass the object to PB_DB2 the PK of the object already exists (was set in object), thus PB_DB2 does not create a new one. If you always do DB1--->DB2 insert all will be ok (then always OJB_HL_SEQ table of the first DB was used), but if you one time do a DB2--->DB1 insert you will run into problems.


Maybe it will be usefull to implement your own SequenceManger class generates keys independent from the databases.

regards,
Armin


Sorry for that thumb question, but I appreciate any help!

Thanks

Christian


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]




--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to