类org.hibernate.id.UUIDGenerator源码实例Demo

下面列出了怎么用org.hibernate.id.UUIDGenerator的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: lams   文件: DefaultIdentifierGeneratorFactory.java
/**
 * Constructs a new DefaultIdentifierGeneratorFactory.
 */
@SuppressWarnings("deprecation")
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( "assigned", Assigned.class );
	register( "identity", IdentityGenerator.class );
	register( "select", SelectGenerator.class );
	register( "sequence", SequenceStyleGenerator.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 );
}
 
源代码2 项目: lams   文件: IdGeneratorInterpreterImpl.java
@Override
public String determineGeneratorName(GenerationType generationType, GeneratorNameDeterminationContext context) {
	switch ( generationType ) {
		case IDENTITY: {
			return "identity";
		}
		case SEQUENCE: {
			return "seqhilo";
		}
		case TABLE: {
			return MultipleHiLoPerTableGenerator.class.getName();
		}
		default: {
			// AUTO

			if ( "increment".equalsIgnoreCase( context.getGeneratedValueGeneratorName() ) ) {
				return IncrementGenerator.class.getName();
			}

			final Class javaType = context.getIdType();
			if ( UUID.class.isAssignableFrom( javaType ) ) {
				return UUIDGenerator.class.getName();
			}

			return "native";
		}
	}
}
 
源代码3 项目: lams   文件: IdGeneratorInterpreterImpl.java
@Override
public String determineGeneratorName(GenerationType generationType, GeneratorNameDeterminationContext context) {
	switch ( generationType ) {
		case IDENTITY: {
			return "identity";
		}
		case SEQUENCE: {
			return org.hibernate.id.enhanced.SequenceStyleGenerator.class.getName();
		}
		case TABLE: {
			return org.hibernate.id.enhanced.TableGenerator.class.getName();
		}
		default: {
			// AUTO

			if ( "increment".equalsIgnoreCase( context.getGeneratedValueGeneratorName() ) ) {
				return IncrementGenerator.class.getName();
			}

			final Class javaType = context.getIdType();
			if ( UUID.class.isAssignableFrom( javaType ) ) {
				return UUIDGenerator.class.getName();
			}

			return org.hibernate.id.enhanced.SequenceStyleGenerator.class.getName();
		}
	}
}
 
源代码4 项目: lams   文件: FileUtil.java
public static String generateUniqueContentFolderID() {
	IdentifierGenerator uuidGen = new UUIDGenerator();
	((Configurable) uuidGen).configure(StringType.INSTANCE, new Properties(), null);

//	Serializable generate(SharedSessionContractImplementor session, Object object)
	
	// lowercase to resolve OS issues
	return ((String) uuidGen.generate(null, null)).toLowerCase();
    }
 
源代码5 项目: lams   文件: ForgotPasswordServlet.java
/**
    * Generates the unique key used for the forgot password request
    *
    * @return a unique key
    * @throws HibernateException
    * @throws FileUtilException
    * @throws IOException
    */
   public static String generateUniqueKey() throws HibernateException {
Properties props = new Properties();

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

return ((String) uuidGen.generate(null, null)).toLowerCase();
   }
 
 类所在包
 同包方法