Package org.hibernate.mapping

Examples of org.hibernate.mapping.Property


            "property-ref to unmapped class: " +
            upr.referencedClass
          );
      }

      Property prop = clazz.getReferencedProperty( upr.propertyName );
      if ( upr.unique ) {
        ( (SimpleValue) prop.getValue() ).setAlternateUniqueKey( true );
      }
    }

    //TODO: Somehow add the newly created foreign keys to the internal collection
View Full Code Here


      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
            );
        }
        return prop.getType();
      }
    };
  }
View Full Code Here

                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;
View Full Code Here

            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() {
        return null;
      }
View Full Code Here

  }

  public String asParameterList(Iterator fields, boolean useGenerics, ImportContext ic) {
    StringBuffer buf = new StringBuffer();
    while ( fields.hasNext() ) {
      Property field = (Property) fields.next();
      buf.append( getJavaTypeName( field, useGenerics, ic ) )
          .append( " " )
          .append( field.getName() );
      if ( fields.hasNext() ) {
        buf.append( ", " );
      }
    }
    return buf.toString();
View Full Code Here

   *         TODO: handle this in a template ?
   */
  public String asArgumentList(Iterator fields) {
    StringBuffer buf = new StringBuffer();
    while ( fields.hasNext() ) {
      Property field = (Property) fields.next();
      buf.append( field.getName() );
      if ( fields.hasNext() ) {
        buf.append( ", " );
      }
    }
    return buf.toString();
View Full Code Here

   */
  public String asNaturalIdParameterList(PersistentClass clazz) {
    Iterator fields = clazz.getRootClass().getPropertyIterator();
    StringBuffer buf = new StringBuffer();
    while ( fields.hasNext() ) {
      Property field = (Property) fields.next();
      if ( field.isNaturalIdentifier() ) {
        buf.append( getJavaTypeName( field, false ) )
            .append( " " )
            .append( field.getName() )
            .append( ", " );
      }
    }
    return buf.substring( 0, buf.length() - 2 );
  }
View Full Code Here

  private void updatePrimaryKey(RootClass rc, PrimaryKeyInfo pki) {
    SimpleValue idValue = (SimpleValue) rc.getIdentifierProperty().getValue();

    Properties defaultStrategyProperties = new Properties();
    Property constrainedOneToOne = getConstrainedOneToOne(rc);
    if(constrainedOneToOne!=null) {
      if(pki.suggestedStrategy==null) {
        idValue.setIdentifierGeneratorStrategy("foreign");
      }

      if(pki.suggestedProperties==null) {
        defaultStrategyProperties.setProperty("property", constrainedOneToOne.getName());
        idValue.setIdentifierGeneratorProperties(defaultStrategyProperties);
      }
    }

View Full Code Here

  }

  private Property getConstrainedOneToOne(RootClass rc) {
    Iterator propertyClosureIterator = rc.getPropertyClosureIterator();
    while (propertyClosureIterator.hasNext()) {
      Property property = (Property) propertyClosureIterator.next();
      if(property.getValue() instanceof OneToOne) {
        OneToOne oto = (OneToOne) property.getValue();
        if(oto.isConstrained()) {
          return property;
        }
      }
    }
View Full Code Here

            foreignKey.getColumns(),
            TableIdentifier.create(foreignKey.getReferencedTable() ),
            foreignKey.getReferencedColumns())) {
          log.debug("Rev.eng excluded one-to-many or one-to-one for foreignkey " + foreignKey.getName());
        } else if (revengStrategy.isOneToOne(foreignKey)){
          Property property = bindOneToOne(rc, foreignKey.getTable(), foreignKey, processed, false, true);
          rc.addProperty(property);
        } else {
          Property property = bindOneToMany(rc, foreignKey, processed, mapping);
          rc.addProperty(property);
        }
      }
    }
  }
View Full Code Here

TOP

Related Classes of org.hibernate.mapping.Property

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.