You are here: Replication With RDBMS > dRS Internals

dRS Internals

How does dRS work to replicate between Hibernate and db4o? This topic gives some insights.

Meta Data

In order to know which version the objects have and the state of the replication peers dRS needs additional information. For this the dRS system adds extra tables which contain this meta data. These meta data has to maintained, otherwise dRS doesn't replicate the changes. To enable this meta-data tracking you need to add a listener to every Hibernate session:

SessionFactory sessionFactory = hibernateConfig.buildSessionFactory();
Session session = sessionFactory.openSession();
ReplicationConfigurator.install(session, hibernateConfig);
Db4oRDBMSReplicationExamples.java: Install the listeners to the session

The Providers

The providers are the peers which replicate to each others. Each database has a unique identity so that the different providers can be distinguished. This data is kept in the 'drs_providers' table.

Column Type Purpose
id long Synthetic, auto-increment primary key.
is_my_sig char(1) 't' when MySignature, 'f' when PeerSignature.
signature binary Holds the unique identifier - byte array.
created long Legacy field for older versions.

The History

The dRS keeps a history of replication with each pair. This history is used to find out when the last replication took place and which objects have changed since the last replication. This data is kept in the 'drs_history' table.

Column Type Purpose
provider_id long Primary key, same as the primary key of a provider.
time long The last version of the last replication session.

The Object Meta Data

For each object there's meta data. This meta data contains a UUID, the version and some additional information. This data is kept in the 'drs_objects' table.

Column Type Purpose
id long Synthetic, auto-increment primary key.
created long The UUID long part of this ObjectReference.
provider_id long Specifies the originating replication provider of this object.
class_name varchar The type of the referenced object.
typed_id long The id used by Hibernate, which is only unique within its type.
modified long The version of the referenced object

Collections

db4o treats collections like regular objects which have a identity. Hibernate however maps collections to joins and therefore collections don't have an identity. To bridge this gap, dRS treats collections as special objects and does not assign UUIDs to them. However this also means that dRS cannot detect changed collections. So currently you cannot replicate collection-updates between db4o and Hibernate.