Hibernate ORM TableHiLoGenerator - 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 TableHiLoGenerator class.

This code example shows how to use the following methods:
 * TableHiLoGenerator which uses control shard to store table with hi values. 
 * 
 * @author Tomislav Nad 
 * @see org.hibernate.id.TableHiLoGenerator 
 */ 
public class ShardedTableHiLoGenerator extends TableHiLoGenerator implements GeneratorRequiringControlSessionProvider {
 
    private ControlSessionProvider controlSessionProvider;
 
    @Override 
    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();
            } 
Full Snippet Info
4
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
See Code Examples for Hibernate ORM TableHiLoGenerator Methods: