Package org.openremote.container.util
Class UniqueIdentifierGenerator
java.lang.Object
org.openremote.container.util.UniqueIdentifierGenerator
- All Implemented Interfaces:
org.hibernate.boot.model.relational.ExportableProducer,org.hibernate.id.Configurable,org.hibernate.id.IdentifierGenerator
public class UniqueIdentifierGenerator
extends Object
implements org.hibernate.id.IdentifierGenerator
Generate a globally unique identifier value.
This is a Hibernate identifier generator as well: Assigns a random UUID if the persisted entity instance is of
type IdentifiableEntity and if its IdentifiableEntity.getId() method returns null.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final com.fasterxml.uuid.impl.NameBasedGeneratorprotected static final com.fasterxml.uuid.impl.RandomBasedGeneratorFields inherited from interface org.hibernate.id.IdentifierGenerator
ENTITY_NAME, GENERATOR_NAME, JPA_ENTITY_NAME -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringGenerates a random UUID value encoded as Base62, 22 characters long.static StringgenerateId(byte[] bytes) Generates the same UUID value encoded as Base62, 22 characters long, if the bytes are the same.static StringgenerateId(String name) Generates the same UUID value encoded as Base62, 22 characters long, if the name is the same.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.hibernate.id.IdentifierGenerator
configure, initialize, registerExportables, supportsJdbcBatchInserts
-
Field Details
-
randomGenerator
protected static final com.fasterxml.uuid.impl.RandomBasedGenerator randomGenerator -
nameGenerator
protected static final com.fasterxml.uuid.impl.NameBasedGenerator nameGenerator
-
-
Constructor Details
-
UniqueIdentifierGenerator
public UniqueIdentifierGenerator()
-
-
Method Details
-
generateId
Generates a random UUID value encoded as Base62, 22 characters long. -
generateId
Generates the same UUID value encoded as Base62, 22 characters long, if the name is the same. -
generateId
Generates the same UUID value encoded as Base62, 22 characters long, if the bytes are the same.