当前位置: 首页>>代码示例>>Java>>正文


Java Configurable类代码示例

本文整理汇总了Java中org.hibernate.id.Configurable的典型用法代码示例。如果您正苦于以下问题:Java Configurable类的具体用法?Java Configurable怎么用?Java Configurable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Configurable类属于org.hibernate.id包,在下文中一共展示了Configurable类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import org.hibernate.id.Configurable; //导入依赖的package包/类
/**
 * The main method.
 * 
 * @param args
 *            the arguments
 * @throws Exception
 *             the exception
 */
public static void main(String[] args) throws Exception {
	Properties props = new Properties();
	props.setProperty("separator", "");
	IdentifierGenerator gen = new UIDGenerator();
	((Configurable) gen).configure(Hibernate.STRING, props, null);
	IdentifierGenerator gen2 = new UIDGenerator();
	((Configurable) gen2).configure(Hibernate.STRING, props, null);

	for (int i = 0; i < 10; i++) {
		String id = (String) gen.generate(null, gen);
		System.out.println(id);
		String id2 = (String) gen2.generate(null, gen2);
		System.out.println(id2);
	}

}
 
开发者ID:8090boy,项目名称:gomall.la,代码行数:25,代码来源:UIDGenerator.java

示例2: createIdentifierGenerator

import org.hibernate.id.Configurable; //导入依赖的package包/类
public IdentifierGenerator createIdentifierGenerator(String strategy, Type type, Properties config) {
        try {
            Class clazz = getIdentifierGeneratorClass( strategy );
            CustomGenerator identifierGenerator = ( CustomGenerator ) clazz.newInstance();
            if ( identifierGenerator instanceof Configurable ) {
                ( ( Configurable ) identifierGenerator ).configure( type, config, dialect );
            }
            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 );
        
   }

}
 
开发者ID:windup,项目名称:windup-rulesets,代码行数:17,代码来源:CustomBuildIdDelegate.java

示例3: createIdentifierGenerator

import org.hibernate.id.Configurable; //导入依赖的package包/类
@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, dialect );
		}
		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 );
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:16,代码来源:DefaultIdentifierGeneratorFactory.java

示例4: generateUniqueContentFolderID

import org.hibernate.id.Configurable; //导入依赖的package包/类
public static String generateUniqueContentFolderID() {
IdentifierGenerator uuidGen = new UUIDGenerator();
((Configurable) uuidGen).configure(StringType.INSTANCE, new Properties(), null);

// lowercase to resolve OS issues
return ((String) uuidGen.generate(null, null)).toLowerCase();
   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:8,代码来源:FileUtil.java

示例5: generateUniqueKey

import org.hibernate.id.Configurable; //导入依赖的package包/类
/**
    * Generates the unique key used for the forgot password request
    *
    * @return a unique key
    * @throws FileUtilException
    * @throws IOException
    */
   public static String generateUniqueKey() {
Properties props = new Properties();

IdentifierGenerator uuidGen = new UUIDGenerator();
((Configurable) uuidGen).configure(StringType.INSTANCE, props, null);

return ((String) uuidGen.generate(null, null)).toLowerCase();
   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:16,代码来源:ForgotPasswordServlet.java

示例6: configure

import org.hibernate.id.Configurable; //导入依赖的package包/类
public void configure(Type type, Properties params, Dialect d) throws MappingException {
    if (getGenerator() instanceof Configurable) {
        if (params.getProperty("schema") == null && sDefaultSchema != null)
            params.setProperty("schema", sDefaultSchema);
        if (params.get("identifier_normalizer") == null && sNormalizer != null)
        	params.put("identifier_normalizer", sNormalizer);
        ((Configurable)getGenerator()).configure(type, params, d);
    }
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:10,代码来源:UniqueIdGenerator.java


注:本文中的org.hibernate.id.Configurable类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。