Java 类org.hibernate.id.IncrementGenerator 实例源码

项目:lams    文件:DefaultIdentifierGeneratorFactory.java   
/**
 * Constructs a new DefaultIdentifierGeneratorFactory.
 */
public DefaultIdentifierGeneratorFactory() {
    register( "uuid2", UUIDGenerator.class );
    register( "guid", GUIDGenerator.class );            // can be done with UUIDGenerator + strategy
    register( "uuid", UUIDHexGenerator.class );         // "deprecated" for new use
    register( "uuid.hex", UUIDHexGenerator.class );     // uuid.hex is deprecated
    register( "hilo", TableHiLoGenerator.class );
    register( "assigned", Assigned.class );
    register( "identity", IdentityGenerator.class );
    register( "select", SelectGenerator.class );
    register( "sequence", SequenceGenerator.class );
    register( "seqhilo", SequenceHiLoGenerator.class );
    register( "increment", IncrementGenerator.class );
    register( "foreign", ForeignGenerator.class );
    register( "sequence-identity", SequenceIdentityGenerator.class );
    register( "enhanced-sequence", SequenceStyleGenerator.class );
    register( "enhanced-table", TableGenerator.class );
}
项目:Portofino    文件:HibernateConfig.java   
protected void setPKColumnGenerator(Mappings mappings, RootClass clazz, Table tab, com.manydesigns.portofino.model.database.Column column, SimpleValue id, Generator generator) {
    if (column.isAutoincrement()) {
        manageIdentityGenerator(mappings, tab, id);
    } else if (generator != null) {
        if (generator instanceof SequenceGenerator) {
            manageSequenceGenerator(mappings, tab, id, (SequenceGenerator) generator);
        } else if (generator instanceof
                            com.manydesigns.portofino.model.database.TableGenerator) {
            manageTableGenerator(mappings, tab, id,
                    (com.manydesigns.portofino.model.database.TableGenerator) generator);
        } else if (generator instanceof
                            com.manydesigns.portofino.model.database.IncrementGenerator){
            manageIncrementGenerator(mappings, tab, id, clazz.getEntityName());
        }
    }
}
项目:manydesigns.cn    文件:HibernateConfig.java   
protected void setPKColumnGenerator(Mappings mappings, RootClass clazz, Table tab, com.manydesigns.portofino.model.database.Column column, SimpleValue id, Generator generator) {
    if (column.isAutoincrement()) {
        manageIdentityGenerator(mappings, tab, id);
    } else if (generator != null) {
        if (generator instanceof SequenceGenerator) {
            manageSequenceGenerator(mappings, tab, id, (SequenceGenerator) generator);
        } else if (generator instanceof
                            com.manydesigns.portofino.model.database.TableGenerator) {
            manageTableGenerator(mappings, tab, id,
                    (com.manydesigns.portofino.model.database.TableGenerator) generator);
        } else if (generator instanceof
                            com.manydesigns.portofino.model.database.IncrementGenerator){
            manageIncrementGenerator(mappings, tab, id, clazz.getEntityName());
        }
    }
}
项目:Portofino    文件:HibernateConfig.java   
private void manageIncrementGenerator(Mappings mappings, Table tab, SimpleValue id, String entityName) {
    id.setIdentifierGeneratorStrategy("increment");
    Properties params = new Properties();
    params.put(PersistentIdentifierGenerator.IDENTIFIER_NORMALIZER,
            mappings.getObjectNameNormalizer());
    params.setProperty(PersistentIdentifierGenerator.SCHEMA, quoteIdentifier(tab.getSchema()));
    params.put(IncrementGenerator.ENTITY_NAME,
            entityName);
    id.setIdentifierGeneratorProperties(params);
    id.setNullValue(null);
}
项目:manydesigns.cn    文件:HibernateConfig.java   
private void manageIncrementGenerator(Mappings mappings, Table tab, SimpleValue id, String entityName) {
    id.setIdentifierGeneratorStrategy("increment");
    Properties params = new Properties();
    params.put(PersistentIdentifierGenerator.IDENTIFIER_NORMALIZER,
            mappings.getObjectNameNormalizer());
    params.setProperty(PersistentIdentifierGenerator.SCHEMA, escapeName(tab.getSchema()));
    params.put(IncrementGenerator.ENTITY_NAME,
            entityName);
    id.setIdentifierGeneratorProperties(params);
    id.setNullValue(null);
}