本文整理汇总了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);
}
});
}
示例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();
}
示例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);
}
示例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();
}
示例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;
}
示例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);
}
}
}
示例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;
}
示例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>();
}
}
示例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);
}
}
示例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;
}
示例11: getJPAEmbeddableType
import javax.persistence.metamodel.EmbeddableType; //导入依赖的package包/类
@Override
public EmbeddableType<?> getJPAEmbeddableType() {
return currentEmbeddableType;
}
示例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);
}
}
示例13: embeddable
import javax.persistence.metamodel.EmbeddableType; //导入依赖的package包/类
@Override
public <X> EmbeddableType<X> embeddable(final Class<X> arg0) {
return null;
}
示例14: getEmbeddables
import javax.persistence.metamodel.EmbeddableType; //导入依赖的package包/类
@Override
public Set<EmbeddableType<?>> getEmbeddables() {
return null;
}
示例15: getJPAEmbeddableType
import javax.persistence.metamodel.EmbeddableType; //导入依赖的package包/类
@Override
public EmbeddableType<?> getJPAEmbeddableType() {
return null;
}