Package javax.persistence.metamodel

Examples of javax.persistence.metamodel.Attribute


    return super.attributeNodes();
  }

  @Override
  protected Attribute<T,?> resolveAttribute(String attributeName) {
        final Attribute attribute = entityType.getAttribute( attributeName );
    if ( attribute == null ) {
      throw new IllegalArgumentException(
          String.format(
              "Given attribute name [%s] is not an attribute on this entity [%s]",
              attributeName,
View Full Code Here


            }
            if ( safeMapping.isVersioned() && property == safeMapping.getVersion() ) {
              // skip the version property, it was already handled previously.
              continue;
            }
            final Attribute attribute = attributeFactory.buildAttribute( jpa2Mapping, property );
            if ( attribute != null ) {
              jpa2Mapping.getBuilder().addAttribute( attribute );
            }
          }
          jpa2Mapping.lock();
          populateStaticMetamodel( jpa2Mapping );
        }
        finally {
                    LOG.trace("Completed entity [" + safeMapping.getEntityName() + "]");
        }
      }
      else if ( MappedSuperclass.class.isAssignableFrom( mapping.getClass() ) ) {
        @SuppressWarnings( "unchecked" )
        final MappedSuperclass safeMapping = (MappedSuperclass) mapping;
                LOG.trace("Starting mapped superclass [" + safeMapping.getMappedClass().getName() + "]");
        try {
          final MappedSuperclassTypeImpl<?> jpa2Mapping = mappedSuperclassByMappedSuperclassMapping.get(
              safeMapping
          );
          applyIdMetadata( safeMapping, jpa2Mapping );
          applyVersionAttribute( safeMapping, jpa2Mapping );
          Iterator<Property> properties = safeMapping.getDeclaredPropertyIterator();
          while ( properties.hasNext() ) {
            final Property property = properties.next();
            if ( safeMapping.isVersioned() && property == safeMapping.getVersion() ) {
              // skip the version property, it was already handled previously.
              continue;
            }
            final Attribute attribute = attributeFactory.buildAttribute( jpa2Mapping, property );
            if ( attribute != null ) {
              jpa2Mapping.getBuilder().addAttribute( attribute );
            }
          }
          jpa2Mapping.lock();
View Full Code Here

            }
            if ( safeMapping.isVersioned() && property == safeMapping.getVersion() ) {
              // skip the version property, it was already handled previously.
              continue;
            }
            final Attribute attribute = attributeFactory.buildAttribute( jpa2Mapping, property );
            if ( attribute != null ) {
              jpa2Mapping.getBuilder().addAttribute( attribute );
            }
          }
          jpa2Mapping.lock();
          populateStaticMetamodel( jpa2Mapping );
        }
        finally {
                    LOG.trace("Completed entity [" + safeMapping.getEntityName() + "]");
        }
      }
      else if ( MappedSuperclass.class.isAssignableFrom( mapping.getClass() ) ) {
        @SuppressWarnings( "unchecked" )
        final MappedSuperclass safeMapping = (MappedSuperclass) mapping;
                LOG.trace("Starting mapped superclass [" + safeMapping.getMappedClass().getName() + "]");
        try {
          final MappedSuperclassTypeImpl<?> jpa2Mapping = mappedSuperclassByMappedSuperclassMapping.get(
              safeMapping
          );
          applyIdMetadata( safeMapping, jpa2Mapping );
          applyVersionAttribute( safeMapping, jpa2Mapping );
          Iterator<Property> properties = safeMapping.getDeclaredPropertyIterator();
          while ( properties.hasNext() ) {
            final Property property = properties.next();
            if ( safeMapping.isVersioned() && property == safeMapping.getVersion() ) {
              // skip the version property, it was already handled previously.
              continue;
            }
            final Attribute attribute = attributeFactory.buildAttribute( jpa2Mapping, property );
            if ( attribute != null ) {
              jpa2Mapping.getBuilder().addAttribute( attribute );
            }
          }
          jpa2Mapping.lock();
View Full Code Here

  public <Y> Path<Y> get(String attributeName) {
    if ( ! canBeDereferenced() ) {
      throw illegalDereference();
    }

    final Attribute attribute = locateAttribute( attributeName );

    if ( attribute.isCollection() ) {
      final PluralAttribute<X,Y,?> pluralAttribute = (PluralAttribute<X,Y,?>) attribute;
      if ( PluralAttribute.CollectionType.MAP.equals( pluralAttribute.getCollectionType() ) ) {
        return (PluralAttributePath<Y>) this.<Object,Object,Map<Object, Object>>get( (MapAttribute) pluralAttribute );
      }
      else {
View Full Code Here

   * @return The attribute; should never return null.
   *
   * @throws IllegalArgumentException If no such attribute exists
   */
  protected  final Attribute locateAttribute(String attributeName) {
    final Attribute attribute = locateAttributeInternal( attributeName );
    if ( attribute == null ) {
      throw unknownAttribute( attributeName );
    }
    return attribute;
  }
View Full Code Here

            }
            if ( safeMapping.isVersioned() && property == safeMapping.getVersion() ) {
              // skip the version property, it was already handled previously.
              continue;
            }
            final Attribute attribute = attributeFactory.buildAttribute( jpa2Mapping, property );
            if ( attribute != null ) {
              jpa2Mapping.getBuilder().addAttribute( attribute );
            }
          }
          jpa2Mapping.lock();
          populateStaticMetamodel( jpa2Mapping );
        }
        finally {
                    LOG.trace("Completed entity [" + safeMapping.getEntityName() + "]");
        }
      }
      else if ( MappedSuperclass.class.isAssignableFrom( mapping.getClass() ) ) {
        @SuppressWarnings( "unchecked" )
        final MappedSuperclass safeMapping = (MappedSuperclass) mapping;
                LOG.trace("Starting mapped superclass [" + safeMapping.getMappedClass().getName() + "]");
        try {
          final MappedSuperclassTypeImpl<?> jpa2Mapping = mappedSuperclassByMappedSuperclassMapping.get(
              safeMapping
          );
          applyIdMetadata( safeMapping, jpa2Mapping );
          applyVersionAttribute( safeMapping, jpa2Mapping );
          Iterator<Property> properties = safeMapping.getDeclaredPropertyIterator();
          while ( properties.hasNext() ) {
            final Property property = properties.next();
            if ( safeMapping.isVersioned() && property == safeMapping.getVersion() ) {
              // skip the version property, it was already handled previously.
              continue;
            }
            final Attribute attribute = attributeFactory.buildAttribute( jpa2Mapping, property );
            if ( attribute != null ) {
              jpa2Mapping.getBuilder().addAttribute( attribute );
            }
          }
          jpa2Mapping.lock();
View Full Code Here

  public <Y> Path<Y> get(String attributeName) {
    if ( ! canBeDereferenced() ) {
      throw illegalDereference();
    }

    final Attribute attribute = locateAttribute( attributeName );

    if ( attribute.isCollection() ) {
      final PluralAttribute<X,Y,?> pluralAttribute = (PluralAttribute<X,Y,?>) attribute;
      if ( PluralAttribute.CollectionType.MAP.equals( pluralAttribute.getCollectionType() ) ) {
        return (PluralAttributePath<Y>) this.<Object,Object,Map<Object, Object>>get( (MapAttribute) pluralAttribute );
      }
      else {
View Full Code Here

   * @return The attribute; should never return null.
   *
   * @throws IllegalArgumentException If no such attribute exists
   */
  protected  final Attribute locateAttribute(String attributeName) {
    final Attribute attribute = locateAttributeInternal( attributeName );
    if ( attribute == null ) {
      throw unknownAttribute( attributeName );
    }
    return attribute;
  }
View Full Code Here

    return managedType != null;
  }

  @Override
  protected Attribute locateAttributeInternal(String attributeName) {
    final Attribute attribute = managedType.getAttribute( attributeName );
    // ManagedType.locateAttribute should throw exception rather than return
    // null, but just to be safe...
    if ( attribute == null ) {
      throw new IllegalArgumentException( "Could not resolve attribute named " + attributeName );
    }
View Full Code Here

            }
            if ( safeMapping.isVersioned() && property == safeMapping.getVersion() ) {
              // skip the version property, it was already handled previously.
              continue;
            }
            final Attribute attribute = attributeFactory.buildAttribute( jpa2Mapping, property );
            if ( attribute != null ) {
              jpa2Mapping.getBuilder().addAttribute( attribute );
            }
          }
          jpa2Mapping.lock();
          populateStaticMetamodel( jpa2Mapping );
        }
        finally {
                    LOG.trace("Completed entity [" + safeMapping.getEntityName() + "]");
        }
      }
      else if ( MappedSuperclass.class.isAssignableFrom( mapping.getClass() ) ) {
        @SuppressWarnings( "unchecked" )
        final MappedSuperclass safeMapping = (MappedSuperclass) mapping;
                LOG.trace("Starting mapped superclass [" + safeMapping.getMappedClass().getName() + "]");
        try {
          final MappedSuperclassTypeImpl<?> jpa2Mapping = mappedSuperclassByMappedSuperclassMapping.get(
              safeMapping
          );
          applyIdMetadata( safeMapping, jpa2Mapping );
          applyVersionAttribute( safeMapping, jpa2Mapping );
          Iterator<Property> properties = safeMapping.getDeclaredPropertyIterator();
          while ( properties.hasNext() ) {
            final Property property = properties.next();
            if ( safeMapping.isVersioned() && property == safeMapping.getVersion() ) {
              // skip the version property, it was already handled previously.
              continue;
            }
            final Attribute attribute = attributeFactory.buildAttribute( jpa2Mapping, property );
            if ( attribute != null ) {
              jpa2Mapping.getBuilder().addAttribute( attribute );
            }
          }
          jpa2Mapping.lock();
View Full Code Here

TOP

Related Classes of javax.persistence.metamodel.Attribute

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.