Tabnine Logo
EntityMetamodel
Code IndexAdd Tabnine to your IDE (free)

How to use
EntityMetamodel
in
com.blazebit.persistence.parser

Best Java code snippets using com.blazebit.persistence.parser.EntityMetamodel (Showing top 20 results out of 315)

origin: Blazebit/blaze-persistence

  @SuppressWarnings("unchecked")
  @Override
  public <X> BasicUserType<X> getBasicUserType(Class<X> clazz) {
    BasicUserType<?> userType = basicUserTypes.get(clazz);
    if (userType == null) {
      if (clazz.isEnum()) {
        // Enums are always considered immutable
        userType = ImmutableBasicUserType.INSTANCE;
      } else if (entityMetamodel.getEntity(clazz) != null) {
        userType = entityBasicUserType;
      } else if (Date.class.isAssignableFrom(clazz)) {
        userType = DateBasicUserType.INSTANCE;
      } else if (Calendar.class.isAssignableFrom(clazz)) {
        userType = CalendarBasicUserType.INSTANCE;
      } else {
        userType = MutableBasicUserType.INSTANCE;
      }
    }

    return (BasicUserType<X>) userType;
  }
}
origin: Blazebit/blaze-persistence

@Override
public ParameterValueTransformer getToEntityTranformer(Class<?> entityType) {
  IdentifiableType<?> managedType = (IdentifiableType<?>) metamodel.getManagedType(entityType);
  Attribute<?, ?> idAttribute = JpaMetamodelUtils.getSingleIdAttribute(managedType);
  return AssociationFromIdParameterTransformer.getInstance(entityType, idAttribute);
}
origin: Blazebit/blaze-persistence

public ScalarTargetResolvingExpressionVisitor(Class<?> managedType, EntityMetamodel metamodel, Map<String, JpqlFunction> functions) {
  this(metamodel.managedType(managedType), metamodel, functions);
}
origin: Blazebit/blaze-persistence

EntityType<?> entityType = m.getEntity(rootNode.getJavaType());
if (entityType == null) {
ExtendedManagedType<?> extendedManagedType = m.getManagedType(ExtendedManagedType.class, entityType);
Set<String> attributePaths;
if (rootNode.getValuesIdNames() != null && !rootNode.getValuesIdNames().isEmpty()) {
    attrPath.setPathReference(new SimplePathReference(rootNode, propertyPath, m.type(extendedAttribute.getElementClass())));
    pathExpressions.add(attrPath);
origin: Blazebit/blaze-persistence

public AbstractUnmappedAttributeCascadeDeleter(EntityViewManagerImpl evm, String attributeName, ExtendedAttribute<?, ?> attribute) {
  EntityMetamodel entityMetamodel = evm.getMetamodel().getEntityMetamodel();
  this.elementEntityClass = attribute.getElementClass();
  this.attributeName = attributeName;
  if (entityMetamodel.getEntity(elementEntityClass) == null) {
    this.elementIdAttributeName = null;
    this.attributeValuePath = attributeName;
    this.cascadeDeleteElement = false;
  } else {
    ExtendedManagedType extendedManagedType = entityMetamodel.getManagedType(ExtendedManagedType.class, elementEntityClass);
    this.elementIdAttributeName = extendedManagedType.getIdAttribute().getName();
    this.attributeValuePath = attributeName + "." + elementIdAttributeName;
    this.cascadeDeleteElement = attribute.isDeleteCascaded();
  }
}
origin: Blazebit/blaze-persistence

this.flushStrategy = viewType.getFlushStrategy();
EntityMetamodel entityMetamodel = evm.getMetamodel().getEntityMetamodel();
EntityType<?> entityType = entityMetamodel.getEntity(entityClass);
ViewToEntityMapper viewIdMapper = null;
  versionAttribute = (AbstractMethodAttribute<?, ?>) ((ViewType) viewType).getVersionAttribute();
  versionFlusher = versionAttribute != null ? createVersionFlusher(evm, entityType, versionAttribute) : null;
  jpaIdAttribute = JpaMetamodelUtils.getSingleIdAttribute(entityMetamodel.entity(entityClass));
  idAttributeName = jpaIdAttribute.getName();
  String mapping = idAttribute.getMapping();
Map<String, ExtendedAttribute> joinTableUnmappedEntityAttributes = new TreeMap<>(entityMetamodel.getManagedType(ExtendedManagedType.class, entityClass).getOwnedAttributes());
if (jpaIdAttribute != null) {
  joinTableUnmappedEntityAttributes.remove(jpaIdAttribute.getName());
  ExtendedAttribute attributeEntry = entry.getValue();
  JoinTable joinTable = attributeEntry.getJoinTable();
  if (joinTable == null && !"".equals(attributeEntry.getMappedBy()) && (entityMetamodel.getEntity(attributeEntry.getElementClass()) == null || !attributeEntry.isDeleteCascaded())) {
    iterator.remove();
    if (extendedAttribute.getAttribute().isCollection()) {
      if ("".equals(extendedAttribute.getMappedBy())) {
        ExtendedManagedType managedType = entityMetamodel.getManagedType(ExtendedManagedType.class, extendedAttribute.getElementClass());
        deleter = new UnmappedWritableBasicAttributeSetNullCascadeDeleter(evm, managedType, extendedAttribute.getWritableMappedByMappings((EntityType<?>) managedType.getType()));
      } else {
        ExtendedManagedType managedType = entityMetamodel.getManagedType(ExtendedManagedType.class, extendedAttribute.getElementClass());
        deleter = new UnmappedWritableBasicAttributeSetNullCascadeDeleter(evm, managedType, extendedAttribute.getWritableMappedByMappings((EntityType<?>) managedType.getType()));
      } else {
origin: Blazebit/blaze-persistence

public UpdatableExpressionVisitor(EntityMetamodel metamodel, Class<?> startClass, boolean updatable) {
  super(metamodel, metamodel.type(startClass), null);
  this.updatable = updatable;
}
origin: Blazebit/blaze-persistence

if (type instanceof ManagedViewType<?>) {
  ManagedViewType<?> subviewType = (ManagedViewType<?>) type;
  if (entityMetamodel.getEntity(subviewType.getEntityClass()) == null) {
    javax.persistence.metamodel.Type<?> attributeIdAttributeType = entityMetamodel.type(JpaMetamodelUtils.resolveFieldClass(attributeViewType.getEntityClass(), attributeIdAttribute));
    List<String> idComponentMappings;
    boolean requiresComponentWiseSetInUpdate = true;
origin: Blazebit/blaze-persistence

private EntityType<?> getTreatType(EntityMetamodel metamodel, Class<?> baseType, Class<?> subtype) {
  if (baseType == subtype) {
    return null;
  }
  return metamodel.entity(subtype);
}
origin: Blazebit/blaze-persistence

ManagedType<?> entityType = context.getEntityMetamodel().getManagedType(getElementType().getJavaType());
if (entityType == null) {
  context.addError("Specifying fetches for non-entity attribute type [" + Arrays.toString(fetches) + "] at the " + getLocation() + " is not allowed!");
  validateTypesCompatible(context.getEntityMetamodel().managedType(correlated), stripThisFromMapping(correlationResult), expressionType, elementType, true, !isCollection(), context, ExpressionLocation.CORRELATION_RESULT, getLocation());
origin: Blazebit/blaze-persistence

ManagedType<?> managedType = evm.getMetamodel().getEntityMetamodel().getManagedType(elementEntityClass);
Attribute<?, ?> inverseAttribute = JpaMetamodelUtils.getAttribute(managedType, attribute.getMappedBy());
  ExtendedManagedType elementManagedType = entityMetamodel.getManagedType(ExtendedManagedType.class, elementEntityClass);
  parentIdAttributeName = entityMetamodel.getManagedType(ExtendedManagedType.class, viewType.getEntityClass()).getIdAttribute().getName();
  childIdAttributeName = elementManagedType.getIdAttribute().getName();
  childEntityToEntityMapper = new InverseEntityToEntityMapper(
      evm,
      evm.getMetamodel().getEntityMetamodel().entity(childType),
      parentEntityOnChildEntityAddMapper,
      parentEntityOnChildEntityRemoveMapper,
origin: Blazebit/blaze-persistence

boolean cascadeUpdate = attribute.isUpdateCascaded();
boolean cascadeDelete = attribute.isDeleteCascaded();
boolean viewOnlyDeleteCascaded = cascadeDelete && !entityMetamodel.getManagedType(ExtendedManagedType.class, entityClass).getAttribute(attributeMapping).isDeleteCascaded();
boolean optimisticLockProtected = attribute.isOptimisticLockProtected();
Set<Type<?>> readOnlyAllowedSubtypes = attribute.getReadOnlyAllowedSubtypes();
    if (entityMetamodel.getEntity(subviewType.getEntityClass()) == null) {
      AttributeAccessor viewAttributeAccessor = Accessors.forViewAttribute(evm, attribute, true);
      javax.persistence.metamodel.Type<?> attributeIdAttributeType = entityMetamodel.type(JpaMetamodelUtils.resolveFieldClass(attributeViewType.getEntityClass(), attributeIdAttribute));
      List<String> idComponentMappings;
      boolean requiresComponentWiseSetInUpdate = true;
      String elementIdAttributeName = entityMetamodel.getManagedType(ExtendedManagedType.class, attributeType.getJavaType()).getIdAttribute().getName();
      deleter = new UnmappedBasicAttributeCascadeDeleter(
          evm,
          attributeName,
          entityMetamodel.getManagedType(ExtendedManagedType.class, entityClass).getAttribute(attributeMapping),
          attributeMapping + "." + elementIdAttributeName,
          false
origin: Blazebit/blaze-persistence

if (elementType instanceof BasicType<?> && context.getEntityMetamodel().getEntity(elementType.getJavaType()) == null
    || elementType instanceof FlatViewType<?>) {
  context.addError("Cascading configuration for basic, embeddable or flat view type attributes is not allowed. Invalid definition found on the " + mapping.getErrorLocation() + "!");
if (embeddableMapping == null) {
  mappingPath = this.mapping;
  managedType = context.getEntityMetamodel().getManagedType(declaringType.getEntityClass());
} else {
  mappingPath = embeddableMapping.getEmbeddableMapping() + "." + this.mapping;
  managedType = context.getEntityMetamodel().getManagedType(embeddableMapping.getEntityClass());
origin: Blazebit/blaze-persistence

@Override
public void visit(TimeLiteral expression) {
  currentPosition.setCurrentType(metamodel.type(Date.class));
}
origin: com.blazebit/blaze-persistence-jpa-criteria-impl

protected final <T> EntityType<T> getTreatType(Class<T> type) {
  return criteriaBuilder.getEntityMetamodel().entity(type);
}
origin: Blazebit/blaze-persistence

@Override
protected void validate(RepositoryMetadata repositoryMetadata) {
  super.validate(repositoryMetadata);
  if (cbf.getService(EntityMetamodel.class).getEntity(repositoryMetadata.getDomainType()) == null) {
    throw new InvalidDataAccessApiUsageException(
        String.format("Cannot implement repository %s when using a non-entity domain type %s. Only types annotated with @Entity are supported!",
            repositoryMetadata.getRepositoryInterface().getName(), repositoryMetadata.getDomainType().getName()));
  }
}
origin: Blazebit/blaze-persistence

ManagedType<?> managedType = context.getEntityMetamodel().getManagedType(declaringType.getEntityClass());
this.mappedBy = mapping.determineMappedBy(managedType, this.mapping, context, embeddableMapping);
this.disallowOwnedUpdatableSubview = context.isDisallowOwnedUpdatableSubview() && mapping.determineDisallowOwnedUpdatableSubview(context, embeddableMapping, updateMappableAttribute) && type instanceof ManagedViewType<?> && mappedBy == null
  if (type instanceof BasicType<?> && context.getEntityMetamodel().getEntity(type.getJavaType()) == null
      || type instanceof FlatViewType<?>) {
    context.addError("Cascading configuration for basic, embeddable or flat view type attributes is not allowed. Invalid definition found on the " + mapping.getErrorLocation() + "!");
origin: Blazebit/blaze-persistence

@Override
public void visit(DateLiteral expression) {
  currentPosition.setCurrentType(metamodel.type(Date.class));
}
origin: Blazebit/blaze-persistence

private String getIdAttribute(Class<?> entityClass) {
  return cbf.getService(EntityMetamodel.class)
      .getManagedType(ExtendedManagedType.class, entityClass)
      .getIdAttribute()
      .getName();
}
origin: Blazebit/blaze-persistence

protected final <T> EntityType<T> getTreatType(Class<T> type) {
  return criteriaBuilder.getEntityMetamodel().entity(type);
}
com.blazebit.persistence.parserEntityMetamodel

Javadoc

This is a wrapper around the JPA javax.persistence.metamodel.Metamodel that allows additionally efficient access by other attributes than a Class.

Most used methods

  • getEntity
  • getManagedType
  • managedType
  • type
  • entity

Popular in Java

  • Creating JSON documents from java classes using gson
  • putExtra (Intent)
  • setScale (BigDecimal)
  • notifyDataSetChanged (ArrayAdapter)
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate
  • MessageFormat (java.text)
    Produces concatenated messages in language-neutral way. New code should probably use java.util.Forma
  • TreeSet (java.util)
    TreeSet is an implementation of SortedSet. All optional operations (adding and removing) are support
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • IOUtils (org.apache.commons.io)
    General IO stream manipulation utilities. This class provides static utility methods for input/outpu
  • Join (org.hibernate.mapping)
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now