
com.strategicgains.repoexpress.cassandra.CassandraUuidEntityRepository Maven / Gradle / Ivy
The newest version!
package com.strategicgains.repoexpress.cassandra;
import com.datastax.driver.core.Session;
import com.strategicgains.repoexpress.domain.UuidIdentifiable;
import com.strategicgains.repoexpress.event.UuidIdentityRepositoryObserver;
/**
* A Cassandra repository that manages types of UuidIdentifiable, which are identified by a single
* UUID primary key. It utilizes the {@link UuidIdentityRepositoryObserver} to assign a UUID on creation.
*
* Storing a UUID as the ID (as this repository does) requires four (4) bytes for the ID.
*
* Extend this repository to persist entities identified by a UUID but do not implement Timestamped, so do not
* need the createdAt and updatedAt time stamps applied.
*
* @author toddf
* @since Jan 28, 2014
* @see CassandraUuidTimestampedEntityRepository
*/
public abstract class CassandraUuidEntityRepository
extends CassandraEntityRepository
{
public CassandraUuidEntityRepository(Session session, String tableName, String identifierColumn)
{
super(session, tableName, identifierColumn);
initializeObservers();
}
protected void initializeObservers()
{
addObserver(new UuidIdentityRepositoryObserver());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy