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
 
    @Override 
    public BigInteger generate(SessionImplementor session, Object obj) {
 
        final String str = new StringBuilder(32)
                .append(format((short) 0))
                .append(format(getIP()))
                .append(format((short) (getJVM() >>> 16)))
                .append(format(getHiTime()))
                .append(format(getLoTime()))
                .append(format(getCount()))
                .toString();
 
        return new BigInteger(str, 16);
    } 
} 
Full Snippet Info
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
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 {
  @Override 
  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);
  } 
} 
Full Snippet Info
3
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java