Package javax.persistence

Examples of javax.persistence.Entity


  public Class<?> getCollectionClass() {
    return null;
  }
 
  public String getEntityName() {
    Entity annotation = klass.getAnnotation(Entity.class);
    if (annotation == null) {
      throw new UnsupportedOperationException("Cannot get Entity Name of non-entity type.");
    } else {
      if (annotation.name() != null && !annotation.name().isEmpty()) {
        return annotation.name();
      } else {
        return klass.getSimpleName();
      }
    }
  }
View Full Code Here


                                          EntityType parentType)
    throws SQLException
  {
    getInternalEntityConfig(type, _annotationCfg);
     
    Entity entityAnn = (Entity) _annotationCfg.getAnnotation();
    EntityConfig entityConfig = _annotationCfg.getEntityConfig();

    boolean isEntity = ! _annotationCfg.isNull();

    if (! isEntity)
      return null;
   
    EntityType entityType;
    String typeName;
   
    if (entityConfig != null)
      typeName = entityConfig.getClassName();
    else
      typeName = entityAnn.name();

    // Validates the type
    String entityName;
    Inheritance inheritanceAnn = null;
    InheritanceConfig inheritanceConfig = null;
    Class rootClass = type;
    Entity rootEntityAnn = null;
    EntityConfig rootEntityConfig = null;

    validateType(type, true);

      // jpa/0ge2
View Full Code Here

    // Validates the type
    String entityName;
    Inheritance inheritanceAnn = null;
    InheritanceConfig inheritanceConfig = null;
    Class rootClass = type;
    Entity rootEntityAnn = null;
    EntityConfig rootEntityConfig = null;

    validateType(type, false);

    // jpa/0ge2
View Full Code Here

      if ( "entity".equals( tree.getName() ) ) {
        AnnotationDescriptor entity = new AnnotationDescriptor( Entity.class );
        copyStringAttribute( entity, tree, "name", false );
        if ( defaults.canUseJavaAnnotations()
            && StringHelper.isEmpty( (String) entity.valueOf( "name" ) ) ) {
          Entity javaAnn = getJavaAnnotation( Entity.class );
          if ( javaAnn != null ) {
            entity.setValue( "name", javaAnn.name() );
          }
        }
        return AnnotationFactory.create( entity );
      }
      else {
View Full Code Here

            }
        }
    }
   
    protected String getEntityName(Class<?> clazz) {
        Entity entity = clazz.getAnnotation(Entity.class);

        // Check if the property name has been defined for Entity annotation
        if (entity != null && !entity.name().equals("")) {
            return entity.name();
        } else {
            return null;
        }
    }
View Full Code Here

        // find / create metadata
        ClassMetaData meta = getMetaData();
        if (meta == null)
            return null;

        Entity entity = (Entity) _cls.getAnnotation(Entity.class);
        if (isMetaDataMode()) {
            // while the spec only provides for embedded exclusive, it doesn't
            // seem hard to support otherwise
            if (entity == null)
                meta.setEmbeddedOnly(true);
            else {
                meta.setEmbeddedOnly(false);
                if (!StringUtils.isEmpty(entity.name()))
                    meta.setTypeAlias(entity.name());
            }
        }

        // track fetch groups to parse them after fields, since they
        // rely on field metadata
View Full Code Here

        // find / create metadata
        ClassMetaData meta = (m == null) ? getMetaData() : m;
        if (meta == null)
            return null;

        Entity entity = _cls.getAnnotation(Entity.class);
        MappedSuperclass mapped = _cls.getAnnotation(MappedSuperclass.class);
        Embeddable embeddable = _cls.getAnnotation(Embeddable.class);
        if (isMetaDataMode()) {
            meta.setAbstract(mapped != null);
            if (embeddable != null) meta.setEmbeddable();
            // while the spec only provides for embedded exclusive, it doesn't
            // seem hard to support otherwise
            if (entity == null)
                meta.setEmbeddedOnly(true);
            else {
                meta.setEmbeddedOnly(false);
                if (!StringUtils.isEmpty(entity.name()))
                    meta.setTypeAlias(entity.name());
            }
        }

        // track fetch groups to parse them after fields, since they
        // rely on field metadata
View Full Code Here

            }
        }
    }
   
    protected String getEntityName(Class<?> clazz) {
        Entity entity = clazz.getAnnotation(Entity.class);

        // Check if the property name has been defined for Entity annotation
        if (entity != null && !entity.name().equals("")) {
            return entity.name();
        } else {
            return null;
        }
    }
View Full Code Here

            }
        }
    }
   
    protected String getEntityName(Class<?> clazz) {
        Entity entity = clazz.getAnnotation(Entity.class);

        // Check if the property name has been defined for Entity annotation
        if (entity != null && !entity.name().equals("")) {
            return entity.name();
        } else {
            return null;
        }
    }
View Full Code Here

        // find / create metadata
        ClassMetaData meta = getMetaData();
        if (meta == null)
            return null;

        Entity entity = (Entity) _cls.getAnnotation(Entity.class);
        MappedSuperclass mapped = (MappedSuperclass)
        _cls.getAnnotation(MappedSuperclass.class);
        if (isMetaDataMode()) {
            meta.setAbstract(mapped != null);
            // while the spec only provides for embedded exclusive, it doesn't
            // seem hard to support otherwise
            if (entity == null)
                meta.setEmbeddedOnly(true);
            else {
                meta.setEmbeddedOnly(false);
                if (!StringUtils.isEmpty(entity.name()))
                    meta.setTypeAlias(entity.name());
            }
        }

        // track fetch groups to parse them after fields, since they
        // rely on field metadata
View Full Code Here

TOP

Related Classes of javax.persistence.Entity

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.