本文整理了Java中javax.persistence.metamodel.Metamodel.embeddable()
方法的一些代码示例,展示了Metamodel.embeddable()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Metamodel.embeddable()
方法的具体详情如下:
包路径:javax.persistence.metamodel.Metamodel
类名称:Metamodel
方法名:embeddable
[英]Return the metamodel embeddable type representing the embeddable class.
[中]返回表示可嵌入类的元模型可嵌入类型。
代码示例来源:origin: hibernate/hibernate-orm
@Test
@TestForIssue(jiraKey = "HHH-11111")
public void testEmbeddableCanBeResolvedWhenUsedAsInterface() {
doInJPA( this::entityManagerFactory, entityManager -> {
assertNotNull( entityManager.getMetamodel().embeddable( LocalizedValue.class ) );
assertEquals( LocalizedValue.class, ProductEntity_.description.getElementType().getJavaType() );
assertNotNull( LocalizedValue_.value );
} );
}
代码示例来源:origin: Impetus/Kundera
private static void getAttributeOfEmbedddable(Map<String, Field> columnNameToFieldMap, Metamodel metaModel,
Attribute attribute)
{
EmbeddableType embeddable = metaModel.embeddable(((AbstractAttribute) attribute).getBindableJavaType());
Iterator<Attribute> embeddableIter = embeddable.getAttributes().iterator();
while (embeddableIter.hasNext())
{
Attribute embedAttrib = embeddableIter.next();
// Reason is to avoid in case embeddable attribute within
// embeddable.
if (!((MetamodelImpl) metaModel).isEmbeddable(embedAttrib.getJavaType()))
{
columnNameToFieldMap.put(((AbstractAttribute) embedAttrib).getJPAColumnName(),
(Field) embedAttrib.getJavaMember());
}
else
{
getAttributeOfEmbedddable(columnNameToFieldMap, metaModel, embedAttrib);
}
}
}
代码示例来源:origin: Impetus/Kundera
EmbeddableType embeddable = metaModel.embeddable(((AbstractAttribute) attribute).getBindableJavaType());
Iterator<Attribute> attributeIter = embeddable.getAttributes().iterator();
while (attributeIter.hasNext())
.getBindableJavaType()))
EmbeddableType nestedEmbeddable = metaModel.embeddable(((AbstractAttribute) attrib)
.getBindableJavaType());
Iterator<Attribute> iter = embeddable.getAttributes().iterator();
代码示例来源:origin: Impetus/Kundera
Map<String, Object> valueMap) throws InstantiationException, IllegalAccessException
EmbeddableType embeddable = metamodel.embeddable(((AbstractAttribute) column).getBindableJavaType());
Field embeddedField = (Field) column.getJavaMember();
Object embeddedDocumentObject = null;
代码示例来源:origin: Impetus/Kundera
String tableName)
EmbeddableType embeddableType = metaModel.embeddable(((AbstractAttribute) column).getBindableJavaType());
Object embeddedObject = PropertyAccessorHelper.getObject(entity, (Field) column.getJavaMember());
Map<String, DBObject> embeddedObjects = new HashMap<String, DBObject>();
代码示例来源:origin: Blazebit/blaze-persistence
@Override
public <X> EmbeddableType<X> embeddable(Class<X> cls) {
return delegate.embeddable(cls);
}
代码示例来源:origin: org.teiid.connectors/translator-jpa
@Override
public <X> EmbeddableType<X> embeddable(Class<X> cls) {
return model.embeddable(cls);
}
代码示例来源:origin: Impetus/Kundera
throws InstantiationException, IllegalAccessException
EmbeddableType embeddable = metamodel.embeddable(((AbstractAttribute) column).getBindableJavaType());
Field embeddedField = (Field) column.getJavaMember();
Object embeddedDocumentObject = null;
代码示例来源:origin: Impetus/Kundera
EmbeddableType embeddable = metaModel.embeddable(attr.getJavaType());
代码示例来源:origin: jaxio/jpa-query-by-example
public <E> Predicate byExampleOnEmbeddable(Path<E> embeddablePath, E embeddableValue, SearchParameters sp, CriteriaBuilder builder) {
if (embeddableValue == null) {
return null;
}
Class<E> type = embeddablePath.getModel().getBindableJavaType();
ManagedType<E> mt = em.getMetamodel().embeddable(type); // note: calling .managedType() does not work
return jpaUtil.orPredicate(builder, byExample(mt, embeddablePath, embeddableValue, sp, builder));
}
代码示例来源:origin: jaxio/generated-projects
public <E> Predicate byExampleOnEmbeddable(Path<E> embeddablePath, E embeddableValue, SearchParameters sp, CriteriaBuilder builder) {
if (embeddableValue == null) {
return null;
}
Class<E> type = embeddablePath.getModel().getBindableJavaType();
ManagedType<E> mt = em.getMetamodel().embeddable(type); // note: calling .managedType() does not work
return jpaUtil.andPredicate(builder, byExample(mt, embeddablePath, embeddableValue, sp, builder));
}
代码示例来源:origin: jaxio/generated-projects
public <E> Predicate byExampleOnEmbeddable(Path<E> embeddablePath, E embeddableValue, SearchParameters sp, CriteriaBuilder builder) {
if (embeddableValue == null) {
return null;
}
Class<E> type = embeddablePath.getModel().getBindableJavaType();
ManagedType<E> mt = em.getMetamodel().embeddable(type); // note: calling .managedType() does not work
return jpaUtil.orPredicate(builder, byExample(mt, embeddablePath, embeddableValue, sp, builder));
}
代码示例来源:origin: jaxio/jpa-query-by-example
public <E> Predicate byExampleOnEmbeddable(Path<E> embeddablePath, E embeddableValue, SearchParameters sp, CriteriaBuilder builder) {
if (embeddableValue == null) {
return null;
}
Class<E> type = embeddablePath.getModel().getBindableJavaType();
ManagedType<E> mt = em.getMetamodel().embeddable(type); // note: calling .managedType() does not work
return jpaUtil.andPredicate(builder, byExample(mt, embeddablePath, embeddableValue, sp, builder));
}
代码示例来源:origin: com.blazebit/blaze-persistence-integration-jpa-base
Type<?> elementType = pluralAttr.getElementType();
if (elementType.getPersistenceType() == Type.PersistenceType.EMBEDDABLE) {
currentType = metamodel.embeddable(currentClass);
} else if (elementType.getPersistenceType() == Type.PersistenceType.BASIC) {
currentType = null;
currentType = metamodel.embeddable(currentClass);
} else if (attr.getPersistentAttributeType() == Attribute.PersistentAttributeType.BASIC) {
currentType = null;
代码示例来源:origin: Blazebit/blaze-persistence
currentType = metamodel.embeddable(currentClass);
} else if (attr.getPersistentAttributeType() == Attribute.PersistentAttributeType.BASIC) {
currentType = null;
代码示例来源:origin: com.blazebit/blaze-persistence-integration-jpa-base
currentType = metamodel.embeddable(currentClass);
} else if (attr.getPersistentAttributeType() == Attribute.PersistentAttributeType.BASIC) {
currentType = null;
代码示例来源:origin: com.impetus.kundera.client/kundera-rdbms
Map<String, Object> valueMap) throws InstantiationException, IllegalAccessException
EmbeddableType embeddable = metamodel.embeddable(((AbstractAttribute) column).getBindableJavaType());
Field embeddedField = (Field) column.getJavaMember();
Object embeddedDocumentObject = null;
代码示例来源:origin: com.impetus.kundera.client/kundera-mongo
String tableName)
EmbeddableType embeddableType = metaModel.embeddable(((AbstractAttribute) column).getBindableJavaType());
Object embeddedObject = PropertyAccessorHelper.getObject(entity, (Field) column.getJavaMember());
Map<String, DBObject> embeddedObjects = new HashMap<String, DBObject>();
代码示例来源:origin: com.impetus.kundera.client/kundera-mongo
throws InstantiationException, IllegalAccessException
EmbeddableType embeddable = metamodel.embeddable(((AbstractAttribute) column).getBindableJavaType());
Field embeddedField = (Field) column.getJavaMember();
Object embeddedDocumentObject = null;
代码示例来源:origin: odata4j/odata4j
static Object typeSafeEntityKey(
EntityManager em,
EntityType<?> jpaEntityType,
OEntityKey entityKey) {
if (entityKey != null
&& jpaEntityType.getIdType().getPersistenceType() == PersistenceType.EMBEDDABLE) {
Object id = newInstance(jpaEntityType.getIdType().getJavaType());
applyOProperties(
em,
em.getMetamodel().embeddable(
jpaEntityType.getIdType().getJavaType()),
entityKey.asComplexProperties(), id);
return id;
}
Class<?> javaType = jpaEntityType.getIdType().getJavaType();
try {
return TypeConverter.convert(entityKey == null ? null : entityKey.asSingleValue(), javaType);
} catch (UnsupportedOperationException e) {
throw new BadRequestException("Invalid key type", e);
} catch (IllegalArgumentException e) {
throw new BadRequestException("Invalid key value", e);
}
}
内容来源于网络,如有侵权,请联系作者删除!