Package javax.persistence.metamodel

Examples of javax.persistence.metamodel.Attribute


            // property represents special handling for id-class mappings but we have already
            // accounted for the embedded property mappings in #applyIdMetadata &&
            // #buildIdClassAttributes
            continue;
          }
          final Attribute attribute = attributeFactory.buildAttribute( jpa2Mapping, property );
          jpa2Mapping.getBuilder().addAttribute( attribute );
        }
        jpa2Mapping.lock();
        populateStaticMetamodel( jpa2Mapping );
      }
      else if ( MappedSuperclass.class.isAssignableFrom( mapping.getClass() ) ) {
        @SuppressWarnings( "unchecked" )
        final MappedSuperclass safeMapping = (MappedSuperclass) mapping;
        final MappedSuperclassTypeImpl<?> jpa2Mapping = mappedSuperclassByMappedSuperclassMapping.get(
            safeMapping
        );
        applyIdMetadata( safeMapping, jpa2Mapping );
        applyVersionAttribute( safeMapping, jpa2Mapping );
        Iterator<Property> properties = ( Iterator<Property> ) safeMapping.getDeclaredPropertyIterator();
        while ( properties.hasNext() ) {
          final Property property = properties.next();
          final Attribute attribute = attributeFactory.buildAttribute( jpa2Mapping, property );
          jpa2Mapping.getBuilder().addAttribute( attribute );
        }
        jpa2Mapping.lock();
        populateStaticMetamodel( jpa2Mapping );
      }
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 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

     * @see javax.persistence.criteria.From#joinCollection(java.lang.String, javax.persistence.criteria.JoinType)
     */
    @SuppressWarnings("hiding")
    public <X, Y> CollectionJoin<X, Y> joinCollection(String attrName, JoinType joinType)
    {
        Attribute attr = getAttributeForAttributeName(attrName);
        return join((CollectionAttribute)attr, joinType);
    }
View Full Code Here

     * @see javax.persistence.criteria.From#joinList(java.lang.String, javax.persistence.criteria.JoinType)
     */
    @SuppressWarnings("hiding")
    public <X, Y> ListJoin<X, Y> joinList(String attrName, JoinType joinType)
    {
        Attribute attr = getAttributeForAttributeName(attrName);
        return join((ListAttribute)attr, joinType);
    }
View Full Code Here

     * @see javax.persistence.criteria.From#joinMap(java.lang.String, javax.persistence.criteria.JoinType)
     */
    @SuppressWarnings("hiding")
    public <X, K, V> MapJoin<X, K, V> joinMap(String attrName, JoinType joinType)
    {
        Attribute attr = getAttributeForAttributeName(attrName);
        return join((MapAttribute)attr, joinType);
    }
View Full Code Here

     * @see javax.persistence.criteria.From#joinSet(java.lang.String, javax.persistence.criteria.JoinType)
     */
    @SuppressWarnings("hiding")
    public <X, Y> SetJoin<X, Y> joinSet(String attrName, JoinType joinType)
    {
        Attribute attr = getAttributeForAttributeName(attrName);
        return join((SetAttribute)attr, joinType);
    }
View Full Code Here

     * @see javax.persistence.criteria.FetchParent#fetch(java.lang.String, javax.persistence.criteria.JoinType)
     */
    @SuppressWarnings("hiding")
    public <X, Y> Fetch<X, Y> fetch(String attrName, JoinType joinType)
    {
        Attribute attr = getAttributeForAttributeName(attrName);
        if (attr instanceof SetAttributeImpl)
        {
            return fetch((SetAttribute)attr, joinType);
        }
        else if (attr instanceof ListAttribute)
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.