Package javax.persistence

Examples of javax.persistence.Access


  }

  private void checkForJpaAccess() {
    List<XProperty> tmpList = new ArrayList<XProperty>();
    for ( XProperty property : fieldAccessMap.values() ) {
      Access access = property.getAnnotation( Access.class );
      if ( access == null ) {
        continue;
      }

      AccessType accessType = AccessType.getAccessStrategy( access.value() );
      if ( accessType == AccessType.PROPERTY ) {
        log.warn( "Placing @Access(AccessType.PROPERTY) on a field does not have any effect." );
        continue;
      }

      tmpList.add( property );
    }
    for ( XProperty property : tmpList ) {
      fieldAccessMap.remove( property.getName() );
      propertyAccessMap.put( property.getName(), property );
    }


    tmpList.clear();
    for ( XProperty property : propertyAccessMap.values() ) {
      Access access = property.getAnnotation( Access.class );
      if ( access == null ) {
        continue;
      }

      AccessType accessType = AccessType.getAccessStrategy( access.value() );
      if ( accessType == AccessType.FIELD ) {
        log.warn( "Placing @Access(AccessType.FIELD) on a field does not have any effect." );
        continue;
      }
View Full Code Here


    org.hibernate.annotations.AccessType accessType = xClass.getAnnotation( org.hibernate.annotations.AccessType.class );
    if ( accessType != null ) {
      hibernateDefinedAccessType = AccessType.getAccessStrategy( accessType.value() );
    }

    Access access = xClass.getAnnotation( Access.class );
    if ( access != null ) {
      jpaDefinedAccessType = AccessType.getAccessStrategy( access.value() );
    }

    if ( hibernateDefinedAccessType != AccessType.DEFAULT
        && jpaDefinedAccessType != AccessType.DEFAULT
        && hibernateDefinedAccessType != jpaDefinedAccessType ) {
View Full Code Here

    org.hibernate.annotations.AccessType accessTypeAnnotation = element.getAnnotation( org.hibernate.annotations.AccessType.class );
    if ( accessTypeAnnotation != null ) {
      hibernateAccessType = AccessType.getAccessStrategy( accessTypeAnnotation.value() );
    }

    Access access = element.getAnnotation( Access.class );
    if ( access != null ) {
      jpaAccessType = AccessType.getAccessStrategy( access.value() );
    }

    if ( hibernateAccessType != null && jpaAccessType != null && hibernateAccessType != jpaAccessType ) {
      throw new MappingException(
          "Found @Access and @AccessType with conflicting values on a property in class " + annotatedClass.toString()
View Full Code Here

     * Explicit access type specification does not affect the access type of
     * other entity classes or mapped super classes in the entity hierarchy.
     */
    private int getAccessCode(Class<?> cls) {
        int accessCode = AccessCode.UNKNOWN;
        Access access = AccessController.doPrivileged(
            J2DoPrivHelper.getAnnotationAction(cls, Access.class));
        if (access != null) {
            accessCode |=  AccessCode.EXPLICIT |
                (access.value() == AccessType.FIELD ?
                AccessCode.FIELD : AccessCode.PROPERTY);
        }
        return accessCode;
    }
View Full Code Here

    org.hibernate.annotations.AccessType accessTypeAnnotation = element.getAnnotation( org.hibernate.annotations.AccessType.class );
    if ( accessTypeAnnotation != null ) {
      hibernateAccessType = AccessType.getAccessStrategy( accessTypeAnnotation.value() );
    }

    Access access = element.getAnnotation( Access.class );
    if ( access != null ) {
      jpaAccessType = AccessType.getAccessStrategy( access.value() );
    }

    if ( hibernateAccessType != null && jpaAccessType != null && hibernateAccessType != jpaAccessType ) {
      throw new MappingException(
          "Found @Access and @AccessType with conflicting values on a property in class " + annotatedClass.toString()
View Full Code Here

    org.hibernate.annotations.AccessType accessTypeAnnotation = element.getAnnotation( org.hibernate.annotations.AccessType.class );
    if ( accessTypeAnnotation != null ) {
      hibernateAccessType = AccessType.getAccessStrategy( accessTypeAnnotation.value() );
    }

    Access access = element.getAnnotation( Access.class );
    if ( access != null ) {
      jpaAccessType = AccessType.getAccessStrategy( access.value() );
    }

    if ( hibernateAccessType != null && jpaAccessType != null && hibernateAccessType != jpaAccessType ) {
      throw new MappingException(
          "Found @Access and @AccessType with conflicting values on a property in class " + annotatedClass.toString()
View Full Code Here

    org.hibernate.annotations.AccessType accessTypeAnnotation = element.getAnnotation( org.hibernate.annotations.AccessType.class );
    if ( accessTypeAnnotation != null ) {
      hibernateAccessType = AccessType.getAccessStrategy( accessTypeAnnotation.value() );
    }

    Access access = element.getAnnotation( Access.class );
    if ( access != null ) {
      jpaAccessType = AccessType.getAccessStrategy( access.value() );
    }

    if ( hibernateAccessType != null && jpaAccessType != null && hibernateAccessType != jpaAccessType ) {
      throw new MappingException(
          "Found @Access and @AccessType with conflicting values on a property in class " + annotatedClass.toString()
View Full Code Here

  public int compareTo(IManagedType managedType) {
    return getType().getName().compareTo(managedType.getType().getName());
  }

  protected AccessType getAccessType() {
    Access accessType = type.getType().getAnnotation(Access.class);
    if (accessType == null) {
      return AccessType.FIELD;
    }
    return accessType.value();
  }
View Full Code Here

    org.hibernate.annotations.AccessType accessTypeAnnotation = element.getAnnotation( org.hibernate.annotations.AccessType.class );
    if ( accessTypeAnnotation != null ) {
      hibernateAccessType = AccessType.getAccessStrategy( accessTypeAnnotation.value() );
    }

    Access access = element.getAnnotation( Access.class );
    if ( access != null ) {
      jpaAccessType = AccessType.getAccessStrategy( access.value() );
    }

    if ( hibernateAccessType != null && jpaAccessType != null && hibernateAccessType != jpaAccessType ) {
      throw new MappingException(
          "Found @Access and @AccessType with conflicting values on a property in class " + annotatedClass.toString()
View Full Code Here

    }
  }

  private void considerExplicitFieldAndPropertyAccess() {
    for ( XProperty property : fieldAccessMap.values() ) {
      Access access = property.getAnnotation( Access.class );
      if ( access == null ) {
        continue;
      }

      // see "2.3.2 Explicit Access Type" of JPA 2 spec
      // the access type for this property is explicitly set to AccessType.FIELD, hence we have to
      // use field access for this property even if the default access type for the class is AccessType.PROPERTY
      AccessType accessType = AccessType.getAccessStrategy( access.value() );
            if (accessType == AccessType.FIELD) {
        propertyAccessMap.put(property.getName(), property);
      }
            else {
        LOG.debug( "Placing @Access(AccessType.FIELD) on a field does not have any effect." );
      }
    }

    for ( XProperty property : propertyAccessMap.values() ) {
      Access access = property.getAnnotation( Access.class );
      if ( access == null ) {
        continue;
      }

      AccessType accessType = AccessType.getAccessStrategy( access.value() );

      // see "2.3.2 Explicit Access Type" of JPA 2 spec
      // the access type for this property is explicitly set to AccessType.PROPERTY, hence we have to
      // return use method access even if the default class access type is AccessType.FIELD
            if (accessType == AccessType.PROPERTY) {
View Full Code Here

TOP

Related Classes of javax.persistence.Access

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.