Code example for TableHiLoGenerator

 * TableHiLoGenerator which uses control shard to store table with hi values. 
 * @author Tomislav Nad 
 * @see 
public class ShardedTableHiLoGenerator extends TableHiLoGenerator implements GeneratorRequiringControlSessionProvider {
    private ControlSessionProvider controlSessionProvider;
    public Serializable generate(final SessionImplementor session, final Object obj) throws HibernateException {
        Serializable id;
        SessionImplementor controlSession = null;
        try { 
            controlSession = controlSessionProvider.openControlSession();
            id = superGenerate(controlSession, obj);
        } finally { 
            if (controlSession != null) {
                ((Session) controlSession).close();
Connect your IDE to all the code out there  Get Codota for Java