(Multiple datasources) Mirror data using hibernate+spring -
using hibernate+spring+as400 database in web application:
there 3 datasources (one per region), ds australia, ds uk , ds usa. schemas same in datasources.
now data needs persisted datasource, rule primary region (selected end user using ui) should used primary datasource save data. in addition, if primary region not usa (say user selected uk region) data should persisted both uk datasource , usa datasource.
i aware of simple manual approach of opening session factories , managing manually. http://www.java-forums.org/database/867-hibernate-multiple-databases.html
what other alternates available , best way implement ?
does needs acid? if not, first idea add @postpersist adds entity jms topic, read 3 clients, each representing 1 database. each client would, then, verify if entity updated in database (by checking optimistic locking column, instance).
with approach may have data consistency problems , need act on each failure each client. on other hand, you'd avoid latency (which why have 3 datasources in first place).
but really, there several possible solutions :-)
Comments
Post a Comment