DualCrud is a persistence utility that allows you to offer a meta instance of a persistence service to its client (for example: a business service). This is especially useful if you want to perform on the fly migration of data models.
Consider following, classical structure:
Now, if you want to migrate this structure to jpa (*Repository) in running system, without downtime, you could construct following DC Structure:
... and you are done
Btw: The components in green are provided by the library.
DualCrud supports following pre-configured modes
whenever an item on left persistence is accessed it is migrated to the right persistance.
same as migrateBackOnTheFly but in reverse direction.
only explicit calls to migrate will trigger data movement from left to right.
same as migrateOnCallOnly but in reverse direction.
read from left but write to both. Useable if you want to have a failover copy.
Use only left persistence.
Use only right persistence.
To create one of the above modes use static factory methods in net.anotheria.anoprise.dualcrud.DualCrudConfig
DualCrud Config properties
The static factory methods in DualCrud configs create broad-purpose configs. However, if the one you're looking for is not there, you can create your own config by setting the properties in the config object directly.
direction in which the data should be migrated
if true after the primary persistence is asked for a data, and returned null or throwed exception, secondary persistence is asked
If true and a migration direction is specified, reading from old persistence will cause a migration.
If true, the service will write to both peristences.
If true upon a successful migration the old copy will be deleted.
If true and a migration direction is specified, writing is only allowed to new persistence. Items on 'old' persistence are migrated to new on write.