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


Java CompositeUserType类代码示例

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


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

示例1: byClass

import org.hibernate.usertype.CompositeUserType; //导入依赖的package包/类
public Type byClass(Class clazz, Properties parameters) {
	if ( Type.class.isAssignableFrom( clazz ) ) {
		return type( clazz, parameters );
	}

	if ( CompositeUserType.class.isAssignableFrom( clazz ) ) {
		return customComponent( clazz, parameters );
	}

	if ( UserType.class.isAssignableFrom( clazz ) ) {
		return custom( clazz, parameters );
	}

	if ( Lifecycle.class.isAssignableFrom( clazz ) ) {
		// not really a many-to-one association *necessarily*
		return manyToOne( clazz.getName() );
	}

	if ( Serializable.class.isAssignableFrom( clazz ) ) {
		return serializable( clazz );
	}

	return null;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:25,代码来源:TypeFactory.java

示例2: custom

import org.hibernate.usertype.CompositeUserType; //导入依赖的package包/类
@Override
@SuppressWarnings({ "unchecked" })
public Type custom(Class userTypeClass, Properties parameters) {
	if ( CompositeUserType.class.isAssignableFrom( userTypeClass ) ) {
		return typeResolver.getTypeFactory().customComponent( userTypeClass, parameters );
	}
	else {
		return typeResolver.getTypeFactory().custom( userTypeClass, parameters );
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:11,代码来源:TypeLocatorImpl.java

示例3: customComponent

import org.hibernate.usertype.CompositeUserType; //导入依赖的package包/类
/**
 * @deprecated Only for use temporary use by {@link org.hibernate.Hibernate}
 */
@Deprecated
   @SuppressWarnings({ "JavaDoc" })
public static CompositeCustomType customComponent(Class<CompositeUserType> typeClass, Properties parameters, TypeScope scope) {
	try {
		CompositeUserType userType = typeClass.newInstance();
		injectParameters( userType, parameters );
		return new CompositeCustomType( userType );
	}
	catch ( Exception e ) {
		throw new MappingException( "Unable to instantiate custom type: " + typeClass.getName(), e );
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:16,代码来源:TypeFactory.java

示例4: CompositeCustomType

import org.hibernate.usertype.CompositeUserType; //导入依赖的package包/类
public CompositeCustomType(Class userTypeClass, Properties parameters) 
throws MappingException {
	name = userTypeClass.getName();

	if ( !CompositeUserType.class.isAssignableFrom(userTypeClass) ) {
		throw new MappingException( 
				"Custom type does not implement CompositeUserType: " + 
				userTypeClass.getName() 
			);
	}
	
	try {
		userType = (CompositeUserType) userTypeClass.newInstance();
	}
	catch (InstantiationException ie) {
		throw new MappingException( 
				"Cannot instantiate custom type: " + 
				userTypeClass.getName() 
			);
	}
	catch (IllegalAccessException iae) {
		throw new MappingException( 
				"IllegalAccessException trying to instantiate custom type: " + 
				userTypeClass.getName() 
			);
	}
	TypeFactory.injectParameters(userType, parameters);
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:29,代码来源:CompositeCustomType.java

示例5: registerTypeOverride

import org.hibernate.usertype.CompositeUserType; //导入依赖的package包/类
public void registerTypeOverride(CompositeUserType type, String[] keys) {
	getTypeResolver().registerTypeOverride( type, keys );
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:4,代码来源:Configuration.java

示例6: registerTypeOverride

import org.hibernate.usertype.CompositeUserType; //导入依赖的package包/类
public void registerTypeOverride(CompositeUserType type, String[] keys) {
	basicTypeRegistry.register( type, keys );
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:4,代码来源:TypeResolver.java

示例7: CompositeCustomType

import org.hibernate.usertype.CompositeUserType; //导入依赖的package包/类
public CompositeCustomType(CompositeUserType userType) {
	this( userType, ArrayHelper.EMPTY_STRING_ARRAY );
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:4,代码来源:CompositeCustomType.java

示例8: getUserType

import org.hibernate.usertype.CompositeUserType; //导入依赖的package包/类
public CompositeUserType getUserType() {
	return userType;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:4,代码来源:CompositeCustomType.java

示例9: register

import org.hibernate.usertype.CompositeUserType; //导入依赖的package包/类
public void register(CompositeUserType type, String[] keys) {
	register( new CompositeCustomType( type, keys ) );
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:4,代码来源:BasicTypeRegistry.java

示例10: newLegacySessionFactory

import org.hibernate.usertype.CompositeUserType; //导入依赖的package包/类
private SessionFactory newLegacySessionFactory() {
    Properties properties = properties();
    Configuration configuration = new Configuration().addProperties(properties);
    for (Class<?> entityClass : entities()) {
        configuration.addAnnotatedClass(entityClass);
    }
    String[] packages = packages();
    if (packages != null) {
        for (String scannedPackage : packages) {
            configuration.addPackage(scannedPackage);
        }
    }
    String[] resources = resources();
    if (resources != null) {
        for (String resource : resources) {
            configuration.addResource(resource);
        }
    }
    Interceptor interceptor = interceptor();
    if (interceptor != null) {
        configuration.setInterceptor(interceptor);
    }

    final List<Type> additionalTypes = additionalTypes();
    if (additionalTypes != null) {
        configuration.registerTypeContributor((typeContributions, serviceRegistry) -> {
            additionalTypes.stream().forEach(type -> {
                if (type instanceof BasicType) {
                    typeContributions.contributeType((BasicType) type);
                } else if (type instanceof UserType) {
                    typeContributions.contributeType((UserType) type);
                } else if (type instanceof CompositeUserType) {
                    typeContributions.contributeType((CompositeUserType) type);
                }
            });
        });
    }
    return configuration.buildSessionFactory(
            new StandardServiceRegistryBuilder()
                    .applySettings(properties)
                    .build()
    );
}
 
开发者ID:vladmihalcea,项目名称:hibernate-types,代码行数:44,代码来源:AbstractTest.java

示例11: newSessionFactory

import org.hibernate.usertype.CompositeUserType; //导入依赖的package包/类
private SessionFactory newSessionFactory() {
    Properties properties = properties();
    Configuration configuration = new Configuration().addProperties(properties);
    for (Class<?> entityClass : entities()) {
        configuration.addAnnotatedClass(entityClass);
    }
    String[] packages = packages();
    if (packages != null) {
        for (String scannedPackage : packages) {
            configuration.addPackage(scannedPackage);
        }
    }
    String[] resources = resources();
    if (resources != null) {
        for (String resource : resources) {
            configuration.addResource(resource);
        }
    }
    Interceptor interceptor = interceptor();
    if (interceptor != null) {
        configuration.setInterceptor(interceptor);
    }

    final List<Type> additionalTypes = additionalTypes();
    if (additionalTypes != null) {
        configuration.registerTypeContributor(new TypeContributor() {
            @Override
            public void contribute(TypeContributions typeContributions, ServiceRegistry serviceRegistry) {
                for (Type type : additionalTypes) {
                    if (type instanceof BasicType) {
                        typeContributions.contributeType((BasicType) type);
                    } else if (type instanceof UserType) {
                        typeContributions.contributeType((UserType) type, new String[]{type.getName()});
                    } else if (type instanceof CompositeUserType) {
                        typeContributions.contributeType((CompositeUserType) type, new String[]{type.getName()});
                    }
                }
            }
        });
    }
    return configuration.buildSessionFactory(
            new StandardServiceRegistryBuilder()
                    .applySettings(properties)
                    .build()
    );
}
 
开发者ID:vladmihalcea,项目名称:hibernate-types,代码行数:47,代码来源:AbstractTest.java

示例12: newLegacySessionFactory

import org.hibernate.usertype.CompositeUserType; //导入依赖的package包/类
private SessionFactory newLegacySessionFactory() {
    Properties properties = properties();
    Configuration configuration = new Configuration().addProperties(properties);
    for (Class<?> entityClass : entities()) {
        configuration.addAnnotatedClass(entityClass);
    }
    String[] packages = packages();
    if (packages != null) {
        for (String scannedPackage : packages) {
            configuration.addPackage(scannedPackage);
        }
    }
    String[] resources = resources();
    if (resources != null) {
        for (String resource : resources) {
            configuration.addResource(resource);
        }
    }
    Interceptor interceptor = interceptor();
    if (interceptor != null) {
        configuration.setInterceptor(interceptor);
    }

    final List<Type> additionalTypes = additionalTypes();
    if (additionalTypes != null) {
        configuration.registerTypeContributor(new TypeContributor() {
            @Override
            public void contribute(TypeContributions typeContributions, ServiceRegistry serviceRegistry) {
                for (Type type : additionalTypes) {
                    if (type instanceof BasicType) {
                        typeContributions.contributeType((BasicType) type);
                    } else if (type instanceof UserType) {
                        typeContributions.contributeType((UserType) type);
                    } else if (type instanceof CompositeUserType) {
                        typeContributions.contributeType((CompositeUserType) type);
                    }
                }
            }
        });
    }
    return configuration.buildSessionFactory(
            new StandardServiceRegistryBuilder()
                    .applySettings(properties)
                    .build()
    );
}
 
开发者ID:vladmihalcea,项目名称:hibernate-types,代码行数:47,代码来源:AbstractTest.java

示例13: heuristicType

import org.hibernate.usertype.CompositeUserType; //导入依赖的package包/类
/**
 * Uses heuristics to deduce a Hibernate type given a string naming the type or Java class.
 * Return an instance of <tt>org.hibernate.type.Type</tt>.
 */
public static Type heuristicType(String typeName, Properties parameters)
		throws MappingException {
	Type type = TypeFactory.basic( typeName );
	if ( type == null ) {
		Class typeClass;
		try {
			typeClass = ReflectHelper.classForName( typeName );
		}
		catch (ClassNotFoundException cnfe) {
			typeClass = null;
		}
		if ( typeClass != null ) {
			if ( Type.class.isAssignableFrom( typeClass ) ) {
				try {
					type = (Type) typeClass.newInstance();
				}
				catch (Exception e) {
					throw new MappingException( 
							"Could not instantiate Type: " + typeClass.getName(),
							e 
						);
				}
				injectParameters(type, parameters);
			}
			else if ( CompositeUserType.class.isAssignableFrom( typeClass ) ) {
				type = new CompositeCustomType( typeClass, parameters );
			}
			else if ( UserType.class.isAssignableFrom( typeClass ) ) {
				type = new CustomType( typeClass, parameters );
			}
			else if ( Lifecycle.class.isAssignableFrom( typeClass ) ) {
				type = Hibernate.entity( typeClass );
			}
			else if ( Serializable.class.isAssignableFrom( typeClass ) ) {
				type = Hibernate.serializable( typeClass );
			}
		}
	}
	return type;

}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:46,代码来源:TypeFactory.java

示例14: newSessionFactory

import org.hibernate.usertype.CompositeUserType; //导入依赖的package包/类
private SessionFactory newSessionFactory() {
    final BootstrapServiceRegistryBuilder bsrb = new BootstrapServiceRegistryBuilder()
        .enableAutoClose();

    Integrator integrator = integrator();
    if (integrator != null) {
        bsrb.applyIntegrator( integrator );
    }

    final BootstrapServiceRegistry bsr = bsrb.build();

    final StandardServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder(bsr)
        .applySettings(properties())
        .build();

    final MetadataSources metadataSources = new MetadataSources(serviceRegistry);

    for (Class annotatedClass : entities()) {
        metadataSources.addAnnotatedClass(annotatedClass);
    }

    String[] packages = packages();
    if (packages != null) {
        for (String annotatedPackage : packages) {
            metadataSources.addPackage(annotatedPackage);
        }
    }

    String[] resources = resources();
    if (resources != null) {
        for (String resource : resources) {
            metadataSources.addResource(resource);
        }
    }

    final MetadataBuilder metadataBuilder = metadataSources.getMetadataBuilder();
    metadataBuilder.enableNewIdentifierGeneratorSupport(true);
    metadataBuilder.applyImplicitNamingStrategy(ImplicitNamingStrategyLegacyJpaImpl.INSTANCE);

    final List<Type> additionalTypes = additionalTypes();
    if (additionalTypes != null) {
        additionalTypes.stream().forEach(type -> {
            metadataBuilder.applyTypes((typeContributions, serviceRegistry1) -> {
                if(type instanceof BasicType) {
                    typeContributions.contributeType((BasicType) type);
                } else if (type instanceof UserType ){
                    typeContributions.contributeType((UserType) type);
                } else if (type instanceof CompositeUserType) {
                    typeContributions.contributeType((CompositeUserType) type);
                }
            });
        });
    }

    MetadataImplementor metadata = (MetadataImplementor) metadataBuilder.build();

    final SessionFactoryBuilder sfb = metadata.getSessionFactoryBuilder();
    Interceptor interceptor = interceptor();
    if(interceptor != null) {
        sfb.applyInterceptor(interceptor);
    }

    return sfb.build();
}
 
开发者ID:vladmihalcea,项目名称:high-performance-java-persistence,代码行数:65,代码来源:AbstractTest.java

示例15: newLegacySessionFactory

import org.hibernate.usertype.CompositeUserType; //导入依赖的package包/类
private SessionFactory newLegacySessionFactory() {
    Properties properties = properties();
    Configuration configuration = new Configuration().addProperties(properties);
    for(Class<?> entityClass : entities()) {
        configuration.addAnnotatedClass(entityClass);
    }
    String[] packages = packages();
    if(packages != null) {
        for(String scannedPackage : packages) {
            configuration.addPackage(scannedPackage);
        }
    }
    String[] resources = resources();
    if (resources != null) {
        for (String resource : resources) {
            configuration.addResource(resource);
        }
    }
    Interceptor interceptor = interceptor();
    if(interceptor != null) {
        configuration.setInterceptor(interceptor);
    }

    final List<Type> additionalTypes = additionalTypes();
    if (additionalTypes != null) {
        configuration.registerTypeContributor((typeContributions, serviceRegistry) -> {
            additionalTypes.stream().forEach(type -> {
                if(type instanceof BasicType) {
                    typeContributions.contributeType((BasicType) type);
                } else if (type instanceof UserType ){
                    typeContributions.contributeType((UserType) type);
                } else if (type instanceof CompositeUserType) {
                    typeContributions.contributeType((CompositeUserType) type);
                }
            });
        });
    }
    return configuration.buildSessionFactory(
            new StandardServiceRegistryBuilder()
                    .applySettings(properties)
                    .build()
    );
}
 
开发者ID:vladmihalcea,项目名称:high-performance-java-persistence,代码行数:44,代码来源:AbstractTest.java


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