Examples of PersistentClass


Examples of net.sf.hibernate.mapping.PersistentClass

    /** iterates through all tables in cfg, tests that they physically exist */
    private boolean allTablesExist() {

        Iterator itr = _cfg.getClassMappings() ;
        while (itr.hasNext()) {
            PersistentClass pClass = (PersistentClass) itr.next() ;
            if (! tableExists(pClass.getTable().getName())) return false ;
        }
        return true;
    }
View Full Code Here

Examples of org.conventionsframework.qualifier.PersistentClass

                }
            }
             //class level annotation
            for (Annotation annotation : getClass().getAnnotations()) {
                if (annotation instanceof PersistentClass) {
                    PersistentClass p = (PersistentClass) annotation;
                    Class c = p.value();
                    return c;
                }
            }
        }//end  ip != null && ip.getAnnotated() != null
        // try resolve via reflection
View Full Code Here

Examples of org.hibernate.mapping.PersistentClass

    //yuk
    ReflectionManager reflectionManager = SearchFactoryImpl.getReflectionManager(cfg);
    //get the most specialized (ie subclass > superclass) non default index name
    //if none extract the name from the most generic (superclass > subclass) @Indexed class in the hierarchy
    //FIXME I'm inclined to get rid of the default value
    PersistentClass pc = cfg.getClassMapping( clazz.getName() );
    XClass rootIndex = null;
    do {
      XClass currentClazz = reflectionManager.toXClass( pc.getMappedClass() );
      Indexed indexAnn = currentClazz.getAnnotation( Indexed.class );
      if ( indexAnn != null ) {
        if ( indexAnn.index().length() != 0 ) {
          return indexAnn.index();
        }
        else {
          rootIndex = currentClazz;
        }
      }
      pc = pc.getSuperclass();
    }
    while ( pc != null );
    //there is nobody out there with a non default @Indexed.index
    if ( rootIndex != null ) {
      return rootIndex.getName();
View Full Code Here

Examples of org.hibernate.mapping.PersistentClass

  protected class OverrideMappings extends MappingsImpl {
    @SuppressWarnings("unchecked")
    @Override
    public void addClass(PersistentClass persistentClass) throws DuplicateMappingException {
      String entityName = persistentClass.getEntityName();
      PersistentClass old = (PersistentClass) classes.get(entityName);
      if (old == null) {
        classes.put(entityName, persistentClass);
      } else if (old.getMappedClass().isAssignableFrom(persistentClass.getMappedClass())) {
        classes.put(entityName, persistentClass);
        logger.info("{} override {} for entity configuration", persistentClass.getClassName(),
            old.getClassName());
      }
      classes.put(persistentClass.getMappedClass().getName(), (PersistentClass) classes.get(entityName));
    }
View Full Code Here

Examples of org.hibernate.mapping.PersistentClass

    Map<String, Set<FkSecondPass>> isADependencyOf = new HashMap<String, Set<FkSecondPass>>();
    List endOfQueueFkSecondPasses = new ArrayList( fkSecondPasses.size() );
    for ( FkSecondPass sp : fkSecondPasses ) {
      if ( sp.isInPrimaryKey() ) {
        String referenceEntityName = sp.getReferencedEntityName();
        PersistentClass classMapping = getClassMapping( referenceEntityName );
        String dependentTable = classMapping.getTable().getQuotedName();
        if ( !isADependencyOf.containsKey( dependentTable ) ) {
          isADependencyOf.put( dependentTable, new HashSet<FkSecondPass>() );
        }
        isADependencyOf.get( dependentTable ).add( sp );
      }
View Full Code Here

Examples of org.hibernate.mapping.PersistentClass

    public PersistentClass getClass(String entityName) {
      return classes.get( entityName );
    }

    public PersistentClass locatePersistentClassByEntityName(String entityName) {
      PersistentClass persistentClass = classes.get( entityName );
      if ( persistentClass == null ) {
        String actualEntityName = imports.get( entityName );
        if ( StringHelper.isNotEmpty( actualEntityName ) ) {
          persistentClass = classes.get( actualEntityName );
        }
View Full Code Here

Examples of org.hibernate.mapping.PersistentClass

    if(entityName==null) {
      throw new MappingException( "<return alias='" + alias + "'> must specify either a class or entity-name");
    }
    LockMode lockMode = getLockMode( returnElem.attributeValue( "lock-mode" ) );

    PersistentClass pc = mappings.getClass( entityName );
    java.util.Map propertyResults = bindPropertyResults(alias, returnElem, pc, mappings );

    return new NativeSQLQueryRootReturn(
        alias,
        entityName,
View Full Code Here

Examples of org.hibernate.mapping.PersistentClass

          Component comp = (Component) value;
          parentPropIter = comp.getPropertyIterator();
        }
        else if ( value instanceof ToOne ) {
          ToOne toOne = (ToOne) value;
          PersistentClass referencedPc = mappings.getClass( toOne.getReferencedEntityName() );
          if ( toOne.getReferencedPropertyName() != null ) {
            try {
              parentPropIter = ( (Component) referencedPc.getRecursiveProperty( toOne.getReferencedPropertyName() ).getValue() ).getPropertyIterator();
            } catch (ClassCastException e) {
              throw new MappingException("dotted notation reference neither a component nor a many/one to one", e);
            }
          }
          else {
            try {
              if ( referencedPc.getIdentifierMapper() == null ) {
                parentPropIter = ( (Component) referencedPc.getIdentifierProperty().getValue() ).getPropertyIterator();
              }
              else {
                parentPropIter = referencedPc.getIdentifierMapper().getPropertyIterator();
              }
            }
            catch (ClassCastException e) {
              throw new MappingException("dotted notation reference neither a component nor a many/one to one", e);
            }
View Full Code Here

Examples of org.hibernate.mapping.PersistentClass

    Map<String, Set<FkSecondPass>> isADependencyOf = new HashMap<String, Set<FkSecondPass>>();
    List<FkSecondPass> endOfQueueFkSecondPasses = new ArrayList<FkSecondPass>( fkSecondPasses.size() );
    for ( FkSecondPass sp : fkSecondPasses ) {
      if ( sp.isInPrimaryKey() ) {
        String referenceEntityName = sp.getReferencedEntityName();
        PersistentClass classMapping = getClassMapping( referenceEntityName );
        String dependentTable = classMapping.getTable().getQuotedName();
        if ( !isADependencyOf.containsKey( dependentTable ) ) {
          isADependencyOf.put( dependentTable, new HashSet<FkSecondPass>() );
        }
        isADependencyOf.get( dependentTable ).add( sp );
      }
View Full Code Here

Examples of org.hibernate.mapping.PersistentClass

    itr = propertyReferences.iterator();
    while ( itr.hasNext() ) {
      Mappings.PropertyReference upr = (Mappings.PropertyReference) itr.next();

      PersistentClass clazz = getClassMapping( upr.referencedClass );
      if ( clazz == null ) {
        throw new MappingException(
            "property-ref to unmapped class: " +
            upr.referencedClass
          );
      }

      Property prop = clazz.getReferencedProperty( upr.propertyName );
      if ( upr.unique ) {
        ( (SimpleValue) prop.getValue() ).setAlternateUniqueKey( true );
      }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.