public synchronized Serializable generate(SessionImplementor session, Object obj) throws HibernateException { if ( lo>maxLo ) { long hival = ( (Number) super.generate(session, obj) ).longValue(); lo = (hival == 0) ? 1 : 0; hi = hival * ( maxLo+1 ); if ( log.isDebugEnabled() ) log.debug("new hi value: " + hival); } return IdentifierGeneratorFactory.createNumber( hi + lo++, returnClass ); }
public synchronized Serializable generate(SessionImplementor session, Object obj) throws HibernateException { if (maxLo < 1) { //keep the behavior consistent even for boundary usages long val = ( (Number) super.generate(session, obj) ).longValue(); if (val == 0) val = ( (Number) super.generate(session, obj) ).longValue(); return IdentifierGeneratorFactory.createNumber( val, returnClass ); } if ( lo>maxLo ) { long hival = ( (Number) super.generate(session, obj) ).longValue(); lo = (hival == 0) ? 1 : 0; hi = hival * ( maxLo+1 ); if ( log.isDebugEnabled() ) log.debug("new hi value: " + hival); } return IdentifierGeneratorFactory.createNumber( hi + lo++, returnClass ); }
/** * The ID is the concatenation of the prefix and a sequence provided by the database, separated * by a dash. * * @param sessionImplementor a hibernate session implementor * @param object the object being persisted * * @return the new generated ID * * @throws HibernateException if something goes wrong */ @Override public Serializable generate( SessionImplementor sessionImplementor, Object object ) throws HibernateException { String prefix = IntactContext.getCurrentInstance().getConfig().getAcPrefix(); String id = prefix + "-" + super.generate( sessionImplementor, object ); log.trace( "Assigning Id: " + id ); return id; }
/** * The ID is the concatenation of the prefix and a sequence provided by the database, separated * by a dash. * * @param sessionImplementor a hibernate session implementor * @param object the object being persisted * * @return the new generated ID * * @throws HibernateException if something goes wrong */ @Override public Serializable generate( SessionImplementor sessionImplementor, Object object ) throws HibernateException { String prefix; if (IntactContext.currentInstanceExists()) { prefix = IntactContext.getCurrentInstance().getConfig().getAcPrefix(); } else { prefix = "UNK"; } String id = prefix + "-" + super.generate( sessionImplementor, object ); log.trace( "Assigning Id: " + id ); return id; }
/** * The ID is the concatenation of the prefix and a sequence provided by the database, separated * by a dash. * * @param sessionImplementor a hibernate session implementor * @param object the object being persisted * * @return the new generated ID * * @throws HibernateException if something goes wrong */ @Override public Serializable generate( SessionImplementor sessionImplementor, Object object ) throws HibernateException { String prefix; if (IntactContext.currentInstanceExists()) { prefix = IntactContext.getCurrentInstance().getConfig().getAcPrefix(); } else { prefix = "UNK"; } String id = prefix + "-" + super.generate( sessionImplementor, object ); log.trace( "Assigning Id: " + id ); return id; }