Example usage for org.hibernate.id SequenceGenerator SEQUENCE

List of usage examples for org.hibernate.id SequenceGenerator SEQUENCE

Introduction

In this page you can find the example usage for org.hibernate.id SequenceGenerator SEQUENCE.

Prototype

String SEQUENCE

To view the source code for org.hibernate.id SequenceGenerator SEQUENCE.

Click Source Link

Document

The sequence parameter

Usage

From source file:org.unitime.banner.util.BannerMessageIdGenerator.java

License:Apache License

public static IdentifierGenerator getGenerator() throws HibernateException {
    try {/*from   w  w w  .ja va 2s . c  o  m*/
        if (sGenerator != null)
            return sGenerator;
        UniqueIdGenerator idGen = new UniqueIdGenerator();
        Dialect dialect = (Dialect) Class
                .forName(LocationDAO.getConfiguration().getProperty("hibernate.dialect"))
                .getConstructor(new Class[] {}).newInstance(new Object[] {});
        Type type = new LongType();
        Properties params = new Properties();
        params.put(SequenceGenerator.SEQUENCE, sSequence);
        params.put(PersistentIdentifierGenerator.SCHEMA,
                _RootDAO.getConfiguration().getProperty("default_schema"));
        idGen.configure(type, params, dialect);
        sGenerator = idGen;
        return sGenerator;
    } catch (HibernateException e) {
        throw e;
    } catch (Exception e) {
        throw new HibernateException(e);
    }
}

From source file:org.unitime.timetable.util.InstrOfferingPermIdGenerator.java

License:Open Source License

public static IdentifierGenerator getGenerator() throws HibernateException {
    try {/*from w  ww.ja va 2 s.c o  m*/
        if (sGenerator != null)
            return sGenerator;
        UniqueIdGenerator idGen = new UniqueIdGenerator();
        Dialect dialect = (Dialect) Class
                .forName(InstructionalOfferingDAO.getConfiguration().getProperty("hibernate.dialect"))
                .getConstructor(new Class[] {}).newInstance(new Object[] {});
        Type type = new IntegerType();
        Properties params = new Properties();
        params.put(SequenceGenerator.SEQUENCE, sSequence);
        params.put(PersistentIdentifierGenerator.SCHEMA,
                _RootDAO.getConfiguration().getProperty("default_schema"));
        idGen.configure(type, params, dialect);
        sGenerator = idGen;
        return sGenerator;
    } catch (HibernateException e) {
        throw e;
    } catch (Exception e) {
        throw new HibernateException(e);
    }
}