org.hibernate.id.UUIDGenerationStrategy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of beangle-hibernate-core Show documentation
Show all versions of beangle-hibernate-core Show documentation
Hibernate Orm Core Shade,Support Scala Collection
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or .
*/
package org.hibernate.id;
import java.io.Serializable;
import java.util.UUID;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
/**
* A strategy for generating a variant 2 {@link UUID} value.
*
* @author Steve Ebersole
*/
public interface UUIDGenerationStrategy extends Serializable {
/**
* Which variant, according to IETF RFC 4122, of UUID does this strategy generate? RFC 4122 defines
* 5 variants (though it only describes algorithms to generate 4):
* - 1 = time based
* - 2 = DCE based using POSIX UIDs
* - 3 = name based (md5 hash)
* - 4 = random numbers based
* - 5 = name based (sha-1 hash)
*
* Returning the values above should be reserved to those generators creating variants compliant with the
* corresponding RFC definition; others can feel free to return other values as they see fit.
*
* Informational only, and not used at this time.
*
* @return The supported generation version
*/
int getGeneratedVersion();
/**
* Generate the UUID.
*
* @param session The session asking for the generation
*
* @return The generated UUID.
*/
UUID generateUUID(SharedSessionContractImplementor session);
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy