Package javax.persistence

Examples of javax.persistence.Entity


        // 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


      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

      throw new AssertionFailure( "Unknown inheritance type: " + inheritanceState.type );
    }
    Proxy proxyAnn = annotatedClass.getAnnotation( Proxy.class );
    BatchSize sizeAnn = annotatedClass.getAnnotation( BatchSize.class );
    Where whereAnn = annotatedClass.getAnnotation( Where.class );
    Entity entityAnn = annotatedClass.getAnnotation( Entity.class );
    org.hibernate.annotations.Entity hibEntityAnn = annotatedClass.getAnnotation(
        org.hibernate.annotations.Entity.class
    );
    org.hibernate.annotations.Cache cacheAnn = annotatedClass.getAnnotation(
        org.hibernate.annotations.Cache.class
View Full Code Here

    return false;
  }

  public static String getEntityName(final BeanDescriptor beanDescriptor) {
    if (beanDescriptor.isAnnotationPresent(Entity.class)) {
      Entity annotation = beanDescriptor.getAnnotation(Entity.class);
      String name = annotation.name();
      if (ConditionUtils.isEmpty(name)) {
        name = beanDescriptor.getType().getSimpleName();
      }
      return name;
    }
View Full Code Here

    PersistentClass superEntity = getSuperEntity(
        clazzToProcess, inheritanceStatePerClass, mappings, inheritanceState
    );

    PersistentClass persistentClass = makePersistentClass( inheritanceState, superEntity );
    Entity entityAnn = clazzToProcess.getAnnotation( Entity.class );
    org.hibernate.annotations.Entity hibEntityAnn = clazzToProcess.getAnnotation(
        org.hibernate.annotations.Entity.class
    );
    EntityBinder entityBinder = new EntityBinder(
        entityAnn, hibEntityAnn, clazzToProcess, persistentClass, mappings
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

    PersistentClass persistentClass = makePersistentClass( inheritanceState, superEntity );

    Proxy proxyAnn = clazzToProcess.getAnnotation( Proxy.class );
    BatchSize sizeAnn = clazzToProcess.getAnnotation( BatchSize.class );
    Where whereAnn = clazzToProcess.getAnnotation( Where.class );
    Entity entityAnn = clazzToProcess.getAnnotation( Entity.class );
    org.hibernate.annotations.Entity hibEntityAnn = clazzToProcess.getAnnotation(
        org.hibernate.annotations.Entity.class
    );

    Cache cacheAnn = determineCacheSettings( clazzToProcess, mappings );
View Full Code Here

public class JPAUtils {

    public static String getEntityName(Class<? extends AbstractFacet> facetClass) {
        try {
            final Entity annotation = facetClass.getAnnotation(Entity.class);
            final String name = annotation.name();
            return name;
        } catch (Throwable t) {
            final String message = "Could not get Facet class for connector for " + facetClass.getName();
            throw new RuntimeException(message);
        }
View Full Code Here

        return query.executeUpdate();
    }

    private long countFacets(Class<? extends AbstractFacet> facetClass,
      long guestId) {
    Entity entityAnnotation = facetClass.getAnnotation(Entity.class);
    String entityName = entityAnnotation.name();
    String queryString = "SELECT count(e) FROM " + entityName + " e WHERE e.guestId=" + guestId;
    Query countQuery = em.createQuery(queryString);
    Object singleResult = countQuery.getSingleResult();
        return (Long) singleResult;
  }
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

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.