Examples of SimpleValue


Examples of org.hibernate.mapping.SimpleValue

  private static void bindSimpleId(Element idNode, RootClass entity, Mappings mappings,
      java.util.Map inheritedMetas) throws MappingException {
    String propertyName = idNode.attributeValue( "name" );

    SimpleValue id = new SimpleValue( entity.getTable() );
    entity.setIdentifier( id );

    // if ( propertyName == null || entity.getPojoRepresentation() == null ) {
    // bindSimpleValue( idNode, id, false, RootClass.DEFAULT_IDENTIFIER_COLUMN_NAME, mappings );
    // if ( !id.isTypeSpecified() ) {
    // throw new MappingException( "must specify an identifier type: " + entity.getEntityName()
    // );
    // }
    // }
    // else {
    // bindSimpleValue( idNode, id, false, propertyName, mappings );
    // PojoRepresentation pojo = entity.getPojoRepresentation();
    // id.setTypeUsingReflection( pojo.getClassName(), propertyName );
    //
    // Property prop = new Property();
    // prop.setValue( id );
    // bindProperty( idNode, prop, mappings, inheritedMetas );
    // entity.setIdentifierProperty( prop );
    // }

    if ( propertyName == null ) {
      bindSimpleValue( idNode, id, false, RootClass.DEFAULT_IDENTIFIER_COLUMN_NAME, mappings );
    }
    else {
      bindSimpleValue( idNode, id, false, propertyName, mappings );
    }

    if ( propertyName == null || !entity.hasPojoRepresentation() ) {
      if ( !id.isTypeSpecified() ) {
        throw new MappingException( "must specify an identifier type: "
          + entity.getEntityName() );
      }
    }
    else {
      id.setTypeUsingReflection( entity.getClassName(), propertyName );
    }

    if ( propertyName != null ) {
      Property prop = new Property();
      prop.setValue( id );
View Full Code Here

Examples of org.hibernate.mapping.SimpleValue

  private static void bindVersioningProperty(Table table, Element subnode, Mappings mappings,
      String name, RootClass entity, java.util.Map inheritedMetas) {

    String propertyName = subnode.attributeValue( "name" );
    SimpleValue val = new SimpleValue( table );
    bindSimpleValue( subnode, val, false, propertyName, mappings );
    if ( !val.isTypeSpecified() ) {
      // this is either a <version/> tag with no type attribute,
      // or a <timestamp/> tag
      if ( "version".equals( name ) ) {
        val.setTypeName( "integer" );
      }
      else {
        if ( "db".equals( subnode.attributeValue( "source" ) ) ) {
          val.setTypeName( "dbtimestamp" );
        }
        else {
          val.setTypeName( "timestamp" );
        }
      }
    }
    Property prop = new Property();
    prop.setValue( val );
View Full Code Here

Examples of org.hibernate.mapping.SimpleValue

    entity.addProperty( prop );
  }

  private static void bindDiscriminatorProperty(Table table, RootClass entity, Element subnode,
      Mappings mappings) {
    SimpleValue discrim = new SimpleValue( table );
    entity.setDiscriminator( discrim );
    bindSimpleValue(
        subnode,
        discrim,
        false,
        RootClass.DEFAULT_DISCRIMINATOR_COLUMN_NAME,
        mappings
      );
    if ( !discrim.isTypeSpecified() ) {
      discrim.setTypeName( "string" );
      // ( (Column) discrim.getColumnIterator().next() ).setType(type);
    }
    entity.setPolymorphic( true );
    if ( "true".equals( subnode.attributeValue( "force" ) ) )
      entity.setForceDiscriminator( true );
View Full Code Here

Examples of org.hibernate.mapping.SimpleValue

        " -> " + joinedSubclass.getTable().getName()
      );

    // KEY
    Element keyNode = node.element( "key" );
    SimpleValue key = new DependantValue( mytable, joinedSubclass.getIdentifier() );
    joinedSubclass.setKey( key );
    key.setCascadeDeleteEnabled( "cascade".equals( keyNode.attributeValue( "on-delete" ) ) );
    bindSimpleValue( keyNode, key, false, joinedSubclass.getEntityName(), mappings );

    // model.getKey().setType( new Type( model.getIdentifier() ) );
    joinedSubclass.createPrimaryKey();
    joinedSubclass.createForeignKey();
View Full Code Here

Examples of org.hibernate.mapping.SimpleValue

        " -> " + join.getTable().getName()
      );

    // KEY
    Element keyNode = node.element( "key" );
    SimpleValue key = new DependantValue( table, persistentClass.getIdentifier() );
    join.setKey( key );
    key.setCascadeDeleteEnabled( "cascade".equals( keyNode.attributeValue( "on-delete" ) ) );
    bindSimpleValue( keyNode, key, false, persistentClass.getEntityName(), mappings );

    // join.getKey().setType( new Type( lazz.getIdentifier() ) );
    join.createPrimaryKey();
    join.createForeignKey();

    // PROPERTIES
    Iterator iter = node.elementIterator();
    while ( iter.hasNext() ) {
      Element subnode = (Element) iter.next();
      String name = subnode.getName();
      String propertyName = subnode.attributeValue( "name" );

      Value value = null;
      if ( "many-to-one".equals( name ) ) {
        value = new ManyToOne( table );
        bindManyToOne( subnode, (ManyToOne) value, propertyName, true, mappings );
      }
      else if ( "any".equals( name ) ) {
        value = new Any( table );
        bindAny( subnode, (Any) value, true, mappings );
      }
      else if ( "property".equals( name ) ) {
        value = new SimpleValue( table );
        bindSimpleValue( subnode, (SimpleValue) value, true, propertyName, mappings );
      }
      else if ( "component".equals( name ) || "dynamic-component".equals( name ) ) {
        String subpath = StringHelper.qualify( path, propertyName );
        value = new Component( join );
View Full Code Here

Examples of org.hibernate.mapping.SimpleValue

      else if ( "any".equals( name ) ) {
        value = new Any( component.getTable() );
        bindAny( subnode, (Any) value, isNullable, mappings );
      }
      else if ( "property".equals( name ) || "key-property".equals( name ) ) {
        value = new SimpleValue( component.getTable() );
        String relativePath;
        if (isEmbedded) {
          relativePath = propertyName;
        }
        else {
View Full Code Here

Examples of org.hibernate.mapping.SimpleValue

      else if ( "one-to-one".equals( name ) ) {
        value = new OneToOne( table, persistentClass );
        bindOneToOne( subnode, (OneToOne) value, propertyName, true, mappings );
      }
      else if ( "property".equals( name ) ) {
        value = new SimpleValue( table );
        bindSimpleValue( subnode, (SimpleValue) value, nullable, propertyName, mappings );
      }
      else if ( "component".equals( name )
        || "dynamic-component".equals( name )
        || "properties".equals( name ) ) {
View Full Code Here

Examples of org.hibernate.mapping.SimpleValue

    bindCollectionSecondPass( node, list, classes, mappings, inheritedMetas );

    Element subnode = node.element( "list-index" );
    if ( subnode == null ) subnode = node.element( "index" );
    SimpleValue iv = new SimpleValue( list.getCollectionTable() );
    bindSimpleValue(
        subnode,
        iv,
        list.isOneToMany(),
        IndexedCollection.DEFAULT_INDEX_COLUMN_NAME,
        mappings
      );
    iv.setTypeName( "integer" );
    list.setIndex( iv );
    String baseIndex = subnode.attributeValue( "base" );
    if ( baseIndex != null ) list.setBaseIndex( Integer.parseInt( baseIndex ) );
    list.setIndexNodeName( subnode.attributeValue("node") );
View Full Code Here

Examples of org.hibernate.mapping.SimpleValue

      java.util.Map inheritedMetas) throws MappingException {

    bindCollectionSecondPass( node, collection, persistentClasses, mappings, inheritedMetas );

    Element subnode = node.element( "collection-id" );
    SimpleValue id = new SimpleValue( collection.getCollectionTable() );
    bindSimpleValue(
        subnode,
        id,
        false,
        IdentifierCollection.DEFAULT_IDENTIFIER_COLUMN_NAME,
View Full Code Here

Examples of org.hibernate.mapping.SimpleValue

    while ( iter.hasNext() ) {
      Element subnode = (Element) iter.next();
      String name = subnode.getName();

      if ( "index".equals( name ) || "map-key".equals( name ) ) {
        SimpleValue value = new SimpleValue( map.getCollectionTable() );
        bindSimpleValue(
            subnode,
            value,
            map.isOneToMany(),
            IndexedCollection.DEFAULT_INDEX_COLUMN_NAME,
            mappings
          );
        if ( !value.isTypeSpecified() ) {
          throw new MappingException( "map index element must specify a type: "
            + map.getRole() );
        }
        map.setIndex( value );
        map.setIndexNodeName( subnode.attributeValue("node") );
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.