Java 类org.hibernate.type.BasicType 实例源码
项目:Equella
文件:ExtendedAnnotationConfiguration.java
public ExtendedAnnotationConfiguration(ExtendedDialect dialect)
{
Iterable<? extends BasicType> types = dialect.getExtraTypeOverrides();
for( BasicType basicType : types )
{
registerTypeOverride(basicType);
}
}
项目:lams
文件:HbmBinder.java
private static void resolveAndBindTypeDef(SimpleValue simpleValue,
Mappings mappings, String typeName, Properties parameters) {
TypeDef typeDef = mappings.getTypeDef( typeName );
if ( typeDef != null ) {
typeName = typeDef.getTypeClass();
// parameters on the property mapping should
// override parameters in the typedef
Properties allParameters = new Properties();
allParameters.putAll( typeDef.getParameters() );
allParameters.putAll( parameters );
parameters = allParameters;
}else if (typeName!=null && !mappings.isInSecondPass()){
BasicType basicType=mappings.getTypeResolver().basic(typeName);
if (basicType==null) {
/*
* If the referenced typeName isn't a basic-type, it's probably a typedef defined
* in a mapping file not read yet.
* It should be solved by deferring the resolution and binding of this type until
* all mapping files are read - the second passes.
* Fixes issue HHH-7300
*/
SecondPass resolveUserTypeMappingSecondPass=new ResolveUserTypeMappingSecondPass(simpleValue,typeName,mappings,parameters);
mappings.addSecondPass(resolveUserTypeMappingSecondPass);
}
}
if ( !parameters.isEmpty() ) simpleValue.setTypeParameters( parameters );
if ( typeName != null ) simpleValue.setTypeName( typeName );
}
项目:lams
文件:TypeLocatorImpl.java
@Override
public BasicType basic(Class javaType) {
BasicType type = typeResolver.basic( javaType.getName() );
if ( type == null ) {
final Class variant = resolvePrimitiveOrPrimitiveWrapperVariantJavaType( javaType );
if ( variant != null ) {
type = typeResolver.basic( variant.getName() );
}
}
return type;
}
项目:Layer-Query
文件:CustomCriteriaQueryTranslator.java
/**
* REVISAR NIKOLAS
*/
@Override
public Type getType(Criteria subcriteria, String propertyName)
throws HibernateException {
System.out.println("Prperty name ==> "+propertyName);
BasicType _type = ((SessionFactoryImpl) sessionFactory).getTypeResolver()
.basic(rootCriteria.getMapColumns().get(propertyName).getType().getName());
/*return getPropertyMapping( getEntityName( subcriteria, propertyName ) )
.toType( getPropertyName( propertyName ) );*/
return _type;
}
项目:hibernate-semantic-query
文件:OrmTypeHelper.java
public static <T> Type convert(
PersisterCreationContext creationContext,
ManagedTypeImplementor source,
String navigableName,
Value valueBinding,
TypeConfiguration typeConfiguration) {
if ( valueBinding.getType() == null ) {
return null;
}
if ( valueBinding.getType() instanceof org.hibernate.type.BasicType ) {
return convertBasic( (BasicType) valueBinding.getType(), typeConfiguration );
}
if ( valueBinding.getType() instanceof org.hibernate.type.CompositeType ) {
return convertEmbedded( creationContext, source, navigableName, (Component) valueBinding, typeConfiguration );
}
if ( valueBinding.getType() instanceof org.hibernate.type.CollectionType ) {
return convertCollection( creationContext, source, navigableName, (Collection) valueBinding, typeConfiguration );
}
if ( valueBinding.getType() instanceof org.hibernate.type.ManyToOneType ) {
return convertEntity( creationContext, source, navigableName, (ToOne) valueBinding, typeConfiguration );
}
throw new NotYetImplementedException( "Converting " + valueBinding.getType().getClass().getName() + " -> org.hibernate.orm.type.spi.Type" );
}
项目:Equella
文件:ExtendedOracle10gDialect.java
@Override
public Iterable<? extends BasicType> getExtraTypeOverrides()
{
return ImmutableList.of(TYPE_BLANKABLE, TYPE_CSV, TYPE_XSTREAM);
}
项目:Equella
文件:ExtendedPostgresDialect.java
@Override
public Iterable<? extends BasicType> getExtraTypeOverrides()
{
return ImmutableList.of(new TextClobType(), TYPE_XSTREAM, TYPE_CSV, TYPE_BLANKABLE);
}
项目:Equella
文件:ExtendedOracle9iDialect.java
@Override
public Iterable<? extends BasicType> getExtraTypeOverrides()
{
return tenG.getExtraTypeOverrides();
}
项目:Equella
文件:SQLServerDialect.java
@Override
public Iterable<? extends BasicType> getExtraTypeOverrides()
{
return ImmutableList.of(new NStringType(), new LongNStringType(), TYPE_BLANKABLE, TYPE_XSTREAM, TYPE_CSV);
}
项目:lams
文件:TypeLocatorImpl.java
@Override
public BasicType basic(String name) {
return typeResolver.basic( name );
}
项目:lams
文件:CoreMessageLogger.java
@LogMessage(level = WARN)
@Message(value = "Type [%s] defined no registration keys; ignoring", id = 269)
void typeDefinedNoRegistrationKeys(BasicType type);
项目:hibernate-types
文件:AbstractTest.java
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()
);
}
项目:hibernate-types
文件:AbstractTest.java
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()
);
}
项目:hibernate-types
文件:AbstractTest.java
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()
);
}
项目:gorm-hibernate5
文件:HibernateQuery.java
protected String render(BasicType basic, List<String> columns, SessionFactory sessionFactory, SQLFunction sqlFunction) {
return sqlFunction.render(basic, columns, (SessionFactoryImplementor) sessionFactory);
}
项目:hibernate-semantic-query
文件:OrmTypeHelper.java
@SuppressWarnings("unchecked")
public static org.hibernate.orm.type.spi.BasicType convertBasic(Property mappingProperty, TypeConfiguration typeConfiguration) {
return typeConfiguration.getBasicTypeRegistry().getBasicType( mappingProperty.getType().getReturnedClass() );
}
项目:high-performance-java-persistence
文件:AbstractTest.java
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();
}
项目:high-performance-java-persistence
文件:AbstractTest.java
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()
);
}
项目:Equella
文件:ExtendedDialect.java
/**
* This method is here because of a bug in hibernate. Types are cached
* before the dialect has a say in it, thus buggering up some of our Lob
* types.
*
* @return
*/
Iterable<? extends BasicType> getExtraTypeOverrides();
项目:lams
文件:Configuration.java
/**
* Allows registration of a type into the type registry. The phrase 'override' in the method name simply
* reminds that registration *potentially* replaces a previously registered type .
*
* @param type The type to register.
*/
public void registerTypeOverride(BasicType type) {
getTypeResolver().registerTypeOverride( type );
}
项目:lams
文件:TypeHelper.java
/**
* Retrieve the basic type registered against the given name.
*
* @param name The name of the basic type to retrieve
*
* @return The basic type, or null.
*/
public BasicType basic(String name);
项目:lams
文件:TypeHelper.java
/**
* Convenience form of {@link #basic(String)}. The intended use of this is something like
* {@code basic(Integer.class)} or {@code basic(int.class)}
*
* @param javaType The java type for which to retrieve the type instance.
*
* @return The basic type, or null.
*/
public BasicType basic(Class javaType);
项目:lams
文件:TypeContributions.java
public void contributeType(BasicType type);