use of org.hibernate.id.IdentifierGenerator in project hibernate-orm by hibernate.
the class DefaultIdentifierGeneratorFactory method createIdentifierGenerator.
@Override
public IdentifierGenerator createIdentifierGenerator(String strategy, Type type, Properties config) {
try {
Class clazz = getIdentifierGeneratorClass(strategy);
IdentifierGenerator identifierGenerator = (IdentifierGenerator) clazz.newInstance();
if (identifierGenerator instanceof Configurable) {
((Configurable) identifierGenerator).configure(type, config, serviceRegistry);
}
return identifierGenerator;
} catch (Exception e) {
final String entityName = config.getProperty(IdentifierGenerator.ENTITY_NAME);
throw new MappingException(String.format("Could not instantiate id generator [entity-name=%s]", entityName), e);
}
}
use of org.hibernate.id.IdentifierGenerator in project hibernate-orm by hibernate.
the class MonotonicRevisionNumberTest method testOracleSequenceOrder.
@Test
public void testOracleSequenceOrder() {
EntityPersister persister = sessionFactory().getEntityPersister(SequenceIdRevisionEntity.class.getName());
IdentifierGenerator generator = persister.getIdentifierGenerator();
Assert.assertTrue(OrderedSequenceGenerator.class.isInstance(generator));
OrderedSequenceGenerator seqGenerator = (OrderedSequenceGenerator) generator;
Assert.assertTrue("Oracle sequence needs to be ordered in RAC environment.", seqGenerator.sqlCreateStrings(getDialect())[0].toLowerCase().endsWith(" order"));
}
Aggregations