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


Java TypeResolver类代码示例

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


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

示例1: createEntityManagerFactory

import org.hibernate.type.TypeResolver; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public EntityManagerFactory createEntityManagerFactory(String persistenceUnitName, Map properties) {

  LOGGER.trace("Starting createEntityManagerFactory for persistenceUnitName {}", persistenceUnitName);

  try {
    final EntityManagerFactoryBuilder builder = getEntityManagerFactoryBuilderOrNull(persistenceUnitName, properties);
    if (builder == null) {
      LOGGER.trace("Could not obtain matching EntityManagerFactoryBuilder, returning null");
      return null;
    } else {
      EntityManagerFactoryImpl impl = (EntityManagerFactoryImpl) builder;
      TypeResolver typeResolver = impl.getSessionFactory().getTypeResolver();
      return builder.build();
    }
  } catch (PersistenceException pe) {
    throw pe;
  } catch (Exception e) {
    LOGGER.debug("Unable to build entity manager factory", e);
    throw new PersistenceException("Unable to build entity manager factory", e);
  }
  // EntityManagerFactory entityManagerFactory = super.createEntityManagerFactory(persistenceUnitName,
  // properties);
  // if (entityManagerFactory instanceof EntityManagerFactoryImpl) {
  // SessionFactoryImpl sessionFactory = ((EntityManagerFactoryImpl)
  // entityManagerFactory).getSessionFactory();
  // TypeResolver typeResolver = sessionFactory.getTypeResolver();
  // // typeResolver.registerTypeOverride(type, keys);
  // }
  // return entityManagerFactory;
}
 
开发者ID:m-m-m,项目名称:persistence,代码行数:35,代码来源:HibernatePersistenceProviderWithGenericDatatypeSupport.java

示例2: addFilterDefinitions

import org.hibernate.type.TypeResolver; //导入依赖的package包/类
private void addFilterDefinitions(FilterProvider provider, ConfigurationProvider configurationProvider) {
	Configuration conf = configurationProvider.getConfiguration();
	conf.buildMappings();
	Map<?, ?> filterDefinitions = conf.getFilterDefinitions();
	TypeResolver resolver = conf.getTypeResolver();
	for (BasicFilterDefinition filterDef : provider.getFilterDefinitions()) {
		Map<String, Type> paramMapConverted = new HashMap<String, Type>();
		for (Entry<String, String> paramEntry : filterDef.getParameterTypeMap().entrySet()) {
			Type type = resolver.heuristicType(paramEntry.getValue());
			paramMapConverted.put(paramEntry.getKey(), type);
		}
		FilterDefinition definition = new FilterDefinition(filterDef.getName(), filterDef.getDefaultCondition(),
				paramMapConverted);
		LOG.debug("Registering new filter definition with name '{}'", definition.getFilterName());
		if (filterDefinitions.containsKey(definition.getFilterName())) {
			LOG.warn("The configuration already has filter definition with name '{}',  overwriting.",
					definition.getFilterName());
		}
		conf.addFilterDefinition(definition);
		filterProviderMap.put(definition.getFilterName(), provider);
		Iterator<PersistentClass> classIterator = conf.getClassMappings();
		while (classIterator.hasNext()) {
			PersistentClass persistentClass = classIterator.next();
			provider.addFilterToClassIfNecesary(persistentClass, filterDef);
		}
	}
	configurationProvider.invalidate();
}
 
开发者ID:frincon,项目名称:openeos,代码行数:29,代码来源:FilterConfigurator.java

示例3: setParameterValues

import org.hibernate.type.TypeResolver; //导入依赖的package包/类
public void setParameterValues(Properties parameters) {
	
	@SuppressWarnings("unchecked")
	final AbstractSingleColumnStandardBasicType<? extends Object> heuristicType = (AbstractSingleColumnStandardBasicType<? extends Object>) new TypeResolver().heuristicType(identifierType.getName(), parameters);
	if (heuristicType == null) {
		throw new HibernateException("Unsupported identifier type " + identifierType.getName());
	}
	
	type = heuristicType;
	sqlTypes = new int[]{ type.sqlType() };
}
 
开发者ID:JadiraOrg,项目名称:jadira,代码行数:12,代码来源:AbstractHeuristicUserType.java

示例4: getTypeResolver

import org.hibernate.type.TypeResolver; //导入依赖的package包/类
public TypeResolver getTypeResolver() {
    return sessionFactoryImplementor.getTypeResolver();
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:4,代码来源:SessionFactoryWrapper.java

示例5: getTypeResolver

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

示例6: TypeLocatorImpl

import org.hibernate.type.TypeResolver; //导入依赖的package包/类
public TypeLocatorImpl(TypeResolver typeResolver) {
	this.typeResolver = typeResolver;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:4,代码来源:TypeLocatorImpl.java

示例7: getTypeResolver

import org.hibernate.type.TypeResolver; //导入依赖的package包/类
protected TypeResolver getTypeResolver(SessionFactory sessionFactory) {
    return ((SessionFactoryImplementor) sessionFactory).getTypeResolver();
}
 
开发者ID:grails,项目名称:gorm-hibernate5,代码行数:4,代码来源:HibernateQuery.java

示例8: addMetadataFromFieldType

import org.hibernate.type.TypeResolver; //导入依赖的package包/类
@Override
public FieldProviderResponse addMetadataFromFieldType(AddMetadataFromFieldTypeRequest addMetadataFromFieldTypeRequest, Map<String, FieldMetadata> metadata) {
    if (!canHandleFieldForTypeMetadata(addMetadataFromFieldTypeRequest, metadata)) {
        return FieldProviderResponse.NOT_HANDLED;
    }
    //look for any map field metadata that was previously added for the requested field
    for (Map.Entry<String, FieldMetadata> entry : addMetadataFromFieldTypeRequest.getPresentationAttributes().entrySet()) {
        if (entry.getKey().startsWith(addMetadataFromFieldTypeRequest.getRequestedPropertyName() + FieldManager.MAPFIELDSEPARATOR)) {
            TypeLocatorImpl typeLocator = new TypeLocatorImpl(new TypeResolver());

            Type myType = null;
            //first, check if an explicit type was declared
            String valueClass = ((BasicFieldMetadata) entry.getValue()).getMapFieldValueClass();
            if (valueClass != null) {
                myType = typeLocator.entity(valueClass);
            }
            if (myType == null) {
                SupportedFieldType fieldType = ((BasicFieldMetadata) entry.getValue()).getExplicitFieldType();
                Class<?> basicJavaType = getBasicJavaType(fieldType);
                if (basicJavaType != null) {
                    myType = typeLocator.basic(basicJavaType);
                }
            }
            if (myType == null) {
                java.lang.reflect.Type genericType = addMetadataFromFieldTypeRequest.getRequestedField().getGenericType();
                if (genericType instanceof ParameterizedType) {
                    ParameterizedType pType = (ParameterizedType) genericType;
                    Class<?> clazz = (Class<?>) pType.getActualTypeArguments()[1];
                    Class<?>[] entities = addMetadataFromFieldTypeRequest.getDynamicEntityDao().getAllPolymorphicEntitiesFromCeiling(clazz);
                    if (!ArrayUtils.isEmpty(entities)) {
                        myType = typeLocator.entity(entities[entities.length-1]);
                    }
                }
            }
            if (myType == null) {
                   throw new IllegalArgumentException("Unable to establish the type for the property (" + entry
                           .getKey() + ")");
            }
            //add property for this map field as if it was a normal field
            super.addMetadataFromFieldType(new AddMetadataFromFieldTypeRequest(addMetadataFromFieldTypeRequest.getRequestedField(),
                    addMetadataFromFieldTypeRequest.getTargetClass(),
                    addMetadataFromFieldTypeRequest.getForeignField(), addMetadataFromFieldTypeRequest.getAdditionalForeignFields(),
                    addMetadataFromFieldTypeRequest.getMergedPropertyType(), addMetadataFromFieldTypeRequest.getComponentProperties(),
                    addMetadataFromFieldTypeRequest.getIdProperty(),
                    addMetadataFromFieldTypeRequest.getPrefix(),
                    entry.getKey(), myType, addMetadataFromFieldTypeRequest.isPropertyForeignKey(),
                    addMetadataFromFieldTypeRequest.getAdditionalForeignKeyIndexPosition(),
                    addMetadataFromFieldTypeRequest.getPresentationAttributes(), entry.getValue(),
                    ((BasicFieldMetadata) entry.getValue()).getExplicitFieldType(),
                    myType.getReturnedClass(), addMetadataFromFieldTypeRequest.getDynamicEntityDao()), metadata);
        }
    }
    return FieldProviderResponse.HANDLED;
}
 
开发者ID:passion1014,项目名称:metaworks_framework,代码行数:55,代码来源:MapFieldsFieldMetadataProvider.java

示例9: getTypeResolver

import org.hibernate.type.TypeResolver; //导入依赖的package包/类
/**
 * Retrieve the type resolver in effect.
 *
 * @return The type resolver.
 */
public TypeResolver getTypeResolver();
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:7,代码来源:Mappings.java

示例10: getTypeResolver

import org.hibernate.type.TypeResolver; //导入依赖的package包/类
/**
 * Retrieve the {@link Type} resolver associated with this factory.
 *
 * @return The type resolver
 */
public TypeResolver getTypeResolver();
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:7,代码来源:SessionFactoryImplementor.java

示例11: getTypeResolver

import org.hibernate.type.TypeResolver; //导入依赖的package包/类
public TypeResolver getTypeResolver(); 
开发者ID:lamsfoundation,项目名称:lams,代码行数:2,代码来源:MetadataImplementor.java


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