Examples of PersistentClass


Examples of org.hibernate.mapping.PersistentClass

              fk.getTable().getName() +
              " does not specify the referenced entity"
            );
        }
                LOG.debugf("Resolving reference to class: %s", referencedEntityName);
        PersistentClass referencedClass = classes.get( referencedEntityName );
        if ( referencedClass == null ) {
          throw new MappingException(
              "An association from the table " +
              fk.getTable().getName() +
              " refers to an unmapped class: " +
              referencedEntityName
            );
        }
        if ( referencedClass.isJoinedSubclass() ) {
          secondPassCompileForeignKeys( referencedClass.getSuperclass().getTable(), done );
        }
        fk.setReferencedTable( referencedClass.getTable() );
        fk.alignColumns();
      }
    }
  }
View Full Code Here

Examples of org.hibernate.mapping.PersistentClass

      /**
       * Returns the identifier type of a mapped class
       */
      public Type getIdentifierType(String entityName) throws MappingException {
        PersistentClass pc = classes.get( entityName );
        if ( pc == null ) {
          throw new MappingException( "persistent class not known: " + entityName );
        }
        return pc.getIdentifier().getType();
      }

      public String getIdentifierPropertyName(String entityName) throws MappingException {
        final PersistentClass pc = classes.get( entityName );
        if ( pc == null ) {
          throw new MappingException( "persistent class not known: " + entityName );
        }
        if ( !pc.hasIdentifierProperty() ) {
          return null;
        }
        return pc.getIdentifierProperty().getName();
      }

      public Type getReferencedPropertyType(String entityName, String propertyName) throws MappingException {
        final PersistentClass pc = classes.get( entityName );
        if ( pc == null ) {
          throw new MappingException( "persistent class not known: " + entityName );
        }
        Property prop = pc.getReferencedProperty( propertyName );
        if ( prop == null ) {
          throw new MappingException(
              "property not known: " +
              entityName + '.' + propertyName
            );
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 (getCacheConcurrencyStrategy() != null) {

                Iterator iter = cfg.getClassMappings();
                while (iter.hasNext()) {
                    PersistentClass clazz = (PersistentClass) iter.next();
                    Iterator props = clazz.getPropertyClosureIterator();
                    boolean hasLob = false;
                    while (props.hasNext()) {
                        Property prop = (Property) props.next();
                        if (prop.getValue().isSimpleValue()) {
                            String type = ((SimpleValue) prop.getValue()).getTypeName();
                            if ("blob".equals(type) || "clob".equals(type))
                                hasLob = true;
                            if (Blob.class.getName().equals(type)
                                    || Clob.class.getName().equals(type))
                                hasLob = true;
                        }
                    }
                    if (!hasLob && !clazz.isInherited() && overrideCacheStrategy()) {
                        cfg.setCacheConcurrencyStrategy(clazz.getEntityName(),
                                getCacheConcurrencyStrategy());
                    }
                }

                iter = cfg.getCollectionMappings();
View Full Code Here

Examples of org.hibernate.mapping.PersistentClass

    {
        org.hibernate.cfg.Configuration config = sessionSource.getConfiguration();
        Iterator<PersistentClass> mappings = config.getClassMappings();
        while (mappings.hasNext())
        {
            final PersistentClass persistentClass = mappings.next();
            final Class entityClass = persistentClass.getMappedClass();

            ValueEncoderFactory factory = new ValueEncoderFactory()
            {
                public ValueEncoder create(Class type)
                {
View Full Code Here

Examples of org.hibernate.mapping.PersistentClass

    return new Mapping() {
      /**
       * Returns the identifier type of a mapped class
       */
      public Type getIdentifierType(String persistentClass) throws MappingException {
        PersistentClass pc = cfg.getClassMapping( persistentClass );
        if (pc==null) throw new MappingException("persistent class not known: " + persistentClass);
        return pc.getIdentifier().getType();
      }

      public String getIdentifierPropertyName(String persistentClass) throws MappingException {
        final PersistentClass pc = cfg.getClassMapping( persistentClass );
        if (pc==null) throw new MappingException("persistent class not known: " + persistentClass);
        if ( !pc.hasIdentifierProperty() ) return null;
        return pc.getIdentifierProperty().getName();
      }

            public Type getReferencedPropertyType(String persistentClass, String propertyName) throws MappingException
            {
        final PersistentClass pc = cfg.getClassMapping( persistentClass );
        if (pc==null) throw new MappingException("persistent class not known: " + persistentClass);
        Property prop = pc.getProperty(propertyName);
        if (prop==nullthrow new MappingException("property not known: " + persistentClass + '.' + propertyName);
        return prop.getType();
      }

      public IdentifierGeneratorFactory getIdentifierGeneratorFactory() {
View Full Code Here

Examples of org.hibernate.mapping.PersistentClass

        }
       
    if(getConfiguration()!=null) {
        Iterator classMappings = getConfiguration().getClassMappings();
        while (classMappings.hasNext() ) {
            PersistentClass element = (PersistentClass) classMappings.next();
            if(element instanceof RootClass) {
                dump(pw, ejb3, element);
            }
        }
    }
View Full Code Here

Examples of org.hibernate.mapping.PersistentClass

      pw.println("<mapping resource=\"" + getMappingFileResource(element) + "\"/>");
    }
     
    Iterator directSubclasses = element.getDirectSubclasses();
    while (directSubclasses.hasNext() ) {
      PersistentClass subclass = (PersistentClass) directSubclasses.next();
      dump(pw, useClass, subclass);   
    }
   
  }
View Full Code Here

Examples of org.hibernate.mapping.PersistentClass

      rc.setTable(table);
      try {
        mappings.addClass(rc);
      } catch(DuplicateMappingException dme) {
        // TODO: detect this and generate a "permutation" of it ?
        PersistentClass class1 = mappings.getClass(dme.getName());
        Table table2 = class1.getTable();
        throw new JDBCBinderException("Duplicate class name '" + rc.getEntityName() + "' generated for '" + table + "'. Same name where generated for '" + table2 + "'");
      }
      mappings.addImport( rc.getEntityName(), rc.getEntityName() );

      Set processed = new HashSet();
View Full Code Here

Examples of org.hibernate.mapping.PersistentClass

            Mappings mappings,
            java.util.Map inheritedMetas) throws MappingException {

        if(collection.isOneToMany() ) {
            OneToMany oneToMany = (OneToMany) collection.getElement();
            PersistentClass persistentClass = mappings.getClass(oneToMany.getReferencedEntityName() );

            if (persistentClass==null) throw new MappingException(
                    "Association " + collection.getRole() + " references unmapped class: " + oneToMany.getReferencedEntityName()
                );
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.