Hibernate ORM UUIDHexGenerator - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Hibernate ORM UUIDHexGenerator class.

This code example shows how to use the following methods:format, getCount, getHiTime, getIP, getJVM
    public BigInteger generate(SessionImplementor session, Object obj) {
        final String str = new StringBuilder(32)
                .append(format((short) 0))
                .append(format((short) (getJVM() >>> 16)))
        return new BigInteger(str, 16);
This code example shows how to use the following methods:
import org.hibernate.id.UUIDHexGenerator;
 * Custom identifier generator that preserves an existing value. 
public class ReportingEventIdGenerator extends UUIDHexGenerator {
  public Serializable generate( final SessionImplementor session,
                                final Object object ) throws HibernateException {
    final Serializable id = session.getEntityPersister(null, object)
        .getClassMetadata().getIdentifier(object, session);
    return id != null ? id : super.generate(session, object);