本文整理汇总了Java中javax.persistence.metamodel.Attribute.isAssociation方法的典型用法代码示例。如果您正苦于以下问题:Java Attribute.isAssociation方法的具体用法?Java Attribute.isAssociation怎么用?Java Attribute.isAssociation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.persistence.metamodel.Attribute
的用法示例。
在下文中一共展示了Attribute.isAssociation方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: containsMultiRelationFetch
import javax.persistence.metamodel.Attribute; //导入方法依赖的package包/类
private static boolean containsMultiRelationFetch(Set<?> fetches) {
for (Object fetchObj : fetches) {
Fetch<?, ?> fetch = (Fetch<?, ?>) fetchObj;
Attribute<?, ?> attr = fetch.getAttribute();
if (attr.isAssociation() && attr.isCollection())
return true;
if (containsMultiRelationFetch(fetch.getFetches()))
return true;
}
return false;
}
示例2: containsMultiRelationJoin
import javax.persistence.metamodel.Attribute; //导入方法依赖的package包/类
private static boolean containsMultiRelationJoin(Set<?> fetches) {
for (Object fetchObj : fetches) {
Fetch<?, ?> fetch = (Fetch<?, ?>) fetchObj;
Attribute<?, ?> attr = fetch.getAttribute();
if (attr.isAssociation() && attr.isCollection())
return true;
if (containsMultiRelationFetch(fetch.getFetches()))
return true;
}
return false;
}
示例3: containsMultiRelationFetch
import javax.persistence.metamodel.Attribute; //导入方法依赖的package包/类
private static boolean containsMultiRelationFetch(Set<?> fetches) {
for (Object fetchObj : fetches) {
Fetch<?, ?> fetch = (Fetch<?, ?>) fetchObj;
Attribute<?, ?> attr = fetch.getAttribute();
if (attr.isAssociation() && attr.isCollection())
return true;
if (containsMultiRelationFetch(fetch.getFetches()))
return true;
}
return false;
}
示例4: containsMultiRelationJoin
import javax.persistence.metamodel.Attribute; //导入方法依赖的package包/类
private static boolean containsMultiRelationJoin(Set<?> fetches) {
for (Object fetchObj : fetches) {
Fetch<?, ?> fetch = (Fetch<?, ?>) fetchObj;
Attribute<?, ?> attr = fetch.getAttribute();
if (attr.isAssociation() && attr.isCollection())
return true;
if (containsMultiRelationFetch(fetch.getFetches()))
return true;
}
return false;
}
示例5: resolveReference
import javax.persistence.metamodel.Attribute; //导入方法依赖的package包/类
private void resolveReference(final Object entity, Attribute<?, ?> attribute) {
if (attribute.isCollection() && !Map.class.isAssignableFrom(attribute.getJavaType())) {
// Properties that are collections of other entities
final Collection<?> current = PropertyHelper.get(entity, attribute.getName());
if (current != null) {
boolean isEntityCollection = true;
final Collection<Entity> resolved = ClassHelper.instantiate(current.getClass());
for (final Object object : current) {
if (object != null && !(object instanceof Entity)) {
isEntityCollection = false;
break;
}
Entity e = (Entity) object;
if (object instanceof EntityReference) {
e = entityManager.find(EntityHelper.getRealClass(e), e.getId());
}
resolved.add(e);
}
if (isEntityCollection) {
PropertyHelper.set(entity, attribute.getName(), resolved);
}
}
} else if (attribute.isAssociation() && !Map.class.isAssignableFrom(attribute.getJavaType())) {
// Properties that are relationships to other entities
Entity rel = PropertyHelper.get(entity, attribute.getName());
if (rel instanceof EntityReference) {
rel = entityManager.find(EntityHelper.getRealClass(rel), rel.getId());
PropertyHelper.set(entity, attribute.getName(), rel);
}
}
}