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


Java EmbeddableType类代码示例

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


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

示例1: analyzeAttributes

import javax.persistence.metamodel.EmbeddableType; //导入依赖的package包/类
private void analyzeAttributes(ManagedType<?> managedType, String targetTableName) {
	managedType.getSingularAttributes().forEach(attribute -> {
		ManagedType<?> targetEntity = managedTypesByClass.get(attribute.getJavaType());
		if (targetEntity != null && attribute.getType() instanceof EmbeddableType) {
			analyzeAttributes((EmbeddableType) attribute.getType(), targetTableName);
		} else if (targetEntity != null && attribute.getType() instanceof IdentifiableType) { // this is a relation
			Map<String, String> referenceColumnNamesMap =
					getReferenceColumnNamesMapForReferenceAttribute(attribute, targetEntity);
			singularAttributesByForeignKeyRelation.put(
					new ForeignKeyRelation(targetTableName, getTableName(targetEntity.getJavaType()), referenceColumnNamesMap),
					attribute
			);
		} else {
			String columnName = getSingularAttributeColumnName(attribute);
			singularAttributesByColumnName.put(new QualifiedColumnName(targetTableName, columnName), attribute);
		}
	});
}
 
开发者ID:btc-ag,项目名称:redg,代码行数:19,代码来源:JpaMetamodelRedGProvider.java

示例2: getJPAEmbeddableType

import javax.persistence.metamodel.EmbeddableType; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
@Override
public EmbeddableType<?> getJPAEmbeddableType() {
  @SuppressWarnings("hiding")
  class JPAComplexAttribute<Long> extends JPAEmbeddableMock<Long> {

    @SuppressWarnings("unchecked")
    @Override
    public Class<Long> getJavaType() {

      return (Class<Long>) java.lang.Long.class;
    }

  }
  return new JPAComplexAttribute();
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:17,代码来源:JPAEdmComplexTypeTest.java

示例3: getEmbeddable

import javax.persistence.metamodel.EmbeddableType; //导入依赖的package包/类
public QEntity getEmbeddable(final Class clazz, final EmbeddableType ct)
{
	if (!entities.containsKey(clazz))
	{
		if (log.isDebugEnabled())
			log.debug("Begin create QEntity " + clazz + " from EmbeddableType " + ct);

		QEntity entity = new QEntity(clazz);
		entities.put(clazz, entity);

		entity.parseEmbeddable(this, sessionFactory, null, ct);

		if (log.isDebugEnabled())
			log.debug("End create QEntity " + clazz + " from EmbeddableType " + ct);
	}

	return entities.get(clazz);
}
 
开发者ID:petergeneric,项目名称:stdlib,代码行数:19,代码来源:QEntityFactory.java

示例4: getJPAEmbeddableType

import javax.persistence.metamodel.EmbeddableType; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
@Override
public EmbeddableType<?> getJPAEmbeddableType() {
  @SuppressWarnings("hiding")
  class JPAComplexAttribute<Long> extends JPAEmbeddableMock<Long>
  {

    @SuppressWarnings("unchecked")
    @Override
    public Class<Long> getJavaType() {

      return (Class<Long>) java.lang.Long.class;
    }

  }
  return new JPAComplexAttribute();
}
 
开发者ID:SAP,项目名称:cloud-odata-java,代码行数:18,代码来源:JPAEdmComplexTypeTest.java

示例5: toTypes

import javax.persistence.metamodel.EmbeddableType; //导入依赖的package包/类
private static Set<Class> toTypes(EntityManagerFactory entityManagerFactory) {
	Set<Class> set = new HashSet<>();

	Set<EmbeddableType<?>> embeddables = entityManagerFactory.getMetamodel().getEmbeddables();
	for (EmbeddableType<?> embeddable : embeddables) {
		set.add(embeddable.getJavaType());
	}

	Set<EntityType<?>> entities = entityManagerFactory.getMetamodel().getEntities();
	for (EntityType<?> entity : entities) {
		set.add(entity.getJavaType());
	}
	return set;
}
 
开发者ID:crnk-project,项目名称:crnk-framework,代码行数:15,代码来源:JpaMetaProvider.java

示例6: discoverElements

import javax.persistence.metamodel.EmbeddableType; //导入依赖的package包/类
@Override
public void discoverElements(MetaProviderContext context) {
	if (entityManagerFactory != null) {
		Set<EmbeddableType<?>> embeddables = entityManagerFactory.getMetamodel().getEmbeddables();
		for (EmbeddableType<?> embeddable : embeddables) {
			context.getLookup().getMeta(embeddable.getJavaType(), MetaJpaDataObject.class);
		}

		Set<EntityType<?>> entities = entityManagerFactory.getMetamodel().getEntities();
		for (EntityType<?> entity : entities) {
			context.getLookup().getMeta(entity.getJavaType(), MetaJpaDataObject.class);
		}
	}
}
 
开发者ID:katharsis-project,项目名称:katharsis-framework,代码行数:15,代码来源:JpaMetaProvider.java

示例7: getPrimaryKeyAttributeNames

import javax.persistence.metamodel.EmbeddableType; //导入依赖的package包/类
/**
    * Gets the attribute names for the primary keys from the given entity type.
    *
    * @param entityType The entity type of the data object.
    * @return A list of primary key attribute names.
    */
protected List<String> getPrimaryKeyAttributeNames(EntityType<?> entityType) {
	List<String> primaryKeyAttributeNames = new ArrayList<String>();
	// JHK: After examining of the metadata structures of EclipseLink, I determined that there
	// was nothing in those which preserved the order of the original annotations.
	// We *need* to know the order of PK fields for KNS/KRAD functionality.
	// So, I'm falling back to checking the annotations and fields on the referenced objects.
	// Yes, the Javadoc states that the getDeclaredFields() method does not guarantee order,
	// But, it's the best we have. And, as of Java 6, it is returning them in declaration order.

	if (entityType.getIdType() instanceof EmbeddableType) {
		for (Field pkField : entityType.getIdType().getJavaType().getDeclaredFields()) {
			primaryKeyAttributeNames.add(pkField.getName());
		}
	} else {
		// First, get the ID attributes from the metadata
		List<String> unsortedPkFields = new ArrayList<String>();
		for (SingularAttribute attr : entityType.getSingularAttributes()) {
			if (attr.isId()) {
				unsortedPkFields.add(attr.getName());
			}
		}

           getPrimaryKeyNamesInOrder(primaryKeyAttributeNames, unsortedPkFields, entityType.getJavaType().getDeclaredFields(), entityType.getJavaType());
	}
	return primaryKeyAttributeNames;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:33,代码来源:JpaMetadataProviderImpl.java

示例8: JPAEdmComplexType

import javax.persistence.metamodel.EmbeddableType; //导入依赖的package包/类
public JPAEdmComplexType(final JPAEdmSchemaView view, final Attribute<?, ?> complexAttribute) {
  super(view);
  schemaView = view;
  for (EmbeddableType<?> jpaEmbeddable : schemaView.getJPAMetaModel().getEmbeddables()) {
    if (jpaEmbeddable.getJavaType().getName().equals(complexAttribute.getJavaType().getName())) {
      nestedComplexType = jpaEmbeddable;
      break;
    }
  }
  directBuild = false;
  if (nonKeyComplexList == null) {
    nonKeyComplexList = new ArrayList<String>();
  }
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:15,代码来源:JPAEdmComplexType.java

示例9: parseEmbeddable

import javax.persistence.metamodel.EmbeddableType; //导入依赖的package包/类
/**
 * Parse an @Embeddable
 *
 * @param entityFactory
 * @param sessionFactory
 * @param prefix
 * @param type
 */
public void parseEmbeddable(final QEntityFactory entityFactory,
                            final SessionFactoryImplementor sessionFactory,
                            final String prefix,
                            final EmbeddableType<?> type)
{
	this.metamodelEmbeddable = type;
	// Make sure the entity factory sees this embeddable
	entityFactory.getEmbeddable(type.getJavaType(), type);

	for (Attribute<?, ?> attribute : type.getAttributes())
	{
		parseFields(entityFactory, sessionFactory, prefix, attribute);
	}
}
 
开发者ID:petergeneric,项目名称:stdlib,代码行数:23,代码来源:QEntity.java

示例10: JPAEdmComplexType

import javax.persistence.metamodel.EmbeddableType; //导入依赖的package包/类
public JPAEdmComplexType(final JPAEdmSchemaView view, final Attribute<?, ?> complexAttribute) {
  super(view);
  schemaView = view;
  for (EmbeddableType<?> jpaEmbeddable : schemaView.getJPAMetaModel().getEmbeddables())
  {
    if (jpaEmbeddable.getJavaType().getName().equals(complexAttribute.getJavaType().getName()))
    {
      nestedComplexType = jpaEmbeddable;
      break;
    }
  }
  directBuild = false;
}
 
开发者ID:SAP,项目名称:cloud-odata-java,代码行数:14,代码来源:JPAEdmComplexType.java

示例11: getJPAEmbeddableType

import javax.persistence.metamodel.EmbeddableType; //导入依赖的package包/类
@Override
public EmbeddableType<?> getJPAEmbeddableType() {
  return currentEmbeddableType;
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:5,代码来源:JPAEdmComplexType.java

示例12: build

import javax.persistence.metamodel.EmbeddableType; //导入依赖的package包/类
@Override
public void build() throws ODataJPAModelException, ODataJPARuntimeException {
  Set<EmbeddableType<?>> embeddables = new HashSet<EmbeddableType<?>>();

  if (consistentComplextTypes == null) {
    consistentComplextTypes = new ArrayList<ComplexType>();
  }

  if (searchMap == null) {
    searchMap = new HashMap<String, ComplexType>();
  }

  if (directBuild) {
    embeddables = schemaView.getJPAMetaModel().getEmbeddables();
  } else {
    embeddables.add(nestedComplexType);
  }

  for (EmbeddableType<?> embeddableType : embeddables) {

    currentEmbeddableType = embeddableType;
    String searchKey = embeddableType.getJavaType().getName();

    if (searchMap.containsKey(searchKey)) {
      continue;
    }

    // Check for need to Exclude
    if (isExcluded(JPAEdmComplexType.this)) {
      continue;
    }

    JPAEdmPropertyView propertyView = new JPAEdmProperty(schemaView, JPAEdmComplexType.this);
    propertyView.getBuilder().build();

    currentComplexType = new ComplexType();
    currentComplexType.setProperties(propertyView.getEdmPropertyList());
    JPAEdmNameBuilder.build(JPAEdmComplexType.this);

    searchMap.put(searchKey, currentComplexType);
    consistentComplextTypes.add(currentComplexType);

  }

}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:46,代码来源:JPAEdmComplexType.java

示例13: embeddable

import javax.persistence.metamodel.EmbeddableType; //导入依赖的package包/类
@Override
public <X> EmbeddableType<X> embeddable(final Class<X> arg0) {
  return null;
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:5,代码来源:JPAMetaModelMock.java

示例14: getEmbeddables

import javax.persistence.metamodel.EmbeddableType; //导入依赖的package包/类
@Override
public Set<EmbeddableType<?>> getEmbeddables() {
  return null;
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:5,代码来源:JPAMetaModelMock.java

示例15: getJPAEmbeddableType

import javax.persistence.metamodel.EmbeddableType; //导入依赖的package包/类
@Override
public EmbeddableType<?> getJPAEmbeddableType() {
  return null;
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:5,代码来源:JPAEdmTestModelView.java


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