Search code examples
javasynchronizationsymmetricds

SymmetricDS - Can't synchronize row with foreign key


I have two tables, let call it table A and B. Table A has a foreign key of table B. My system creates first a row in table B, and in another screen user can create a row in table A that is related to the created row in table B. These two rows need be send to a specific SymmetricDS client, to do this I'm using a subselect router for each table. The problem is: the row created in table B only know where it need go when the row in table A is created. When it happens, SymmetricDS already evaluated the subselect router of table B and considered the batch as unrouted. As the row of table B was not routed, the client can't create the row in table A due a foreign key error. Is there a way I can guarantee that the two rows will synchronize together?


Solution

  • yes there is. use trigger customization. you'll have to wait until the version 3.7 is released or take the latest version of the source, apply the patch http://www.symmetricds.org/issues/view.php?id=1570 and declare before trigger customization for the table A which will update the row with the foreign key in the table B and have it being routed to the target before the row in table A