Package org.hibernate.mapping

Examples of org.hibernate.mapping.SimpleValue


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


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

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

    Element subnode = node.element( "list-index" );
    if ( subnode == null ) subnode = node.element( "index" );
    SimpleValue iv = new SimpleValue( mappings, 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

      java.util.Map inheritedMetas) throws MappingException {

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

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

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

      if ( "index".equals( name ) || "map-key".equals( name ) ) {
        SimpleValue value = new SimpleValue( mappings, 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

          keyVal = collection.getOwner().getIdentifier();
        }
        else {
          keyVal = (KeyValue) collection.getOwner().getRecursiveProperty( propRef ).getValue();
        }
        SimpleValue key = new DependantValue( mappings, collection.getCollectionTable(), keyVal );
        key.setCascadeDeleteEnabled( "cascade"
          .equals( subnode.attributeValue( "on-delete" ) ) );
        bindSimpleValue(
            subnode,
            key,
            collection.isOneToMany(),
            Collection.DEFAULT_KEY_COLUMN_NAME,
            mappings
          );
        collection.setKey( key );

        Attribute notNull = subnode.attribute( "not-null" );
        ( (DependantValue) key ).setNullable( notNull == null
          || notNull.getValue().equals( "false" ) );
        Attribute updateable = subnode.attribute( "update" );
        ( (DependantValue) key ).setUpdateable( updateable == null
          || updateable.getValue().equals( "true" ) );

      }
      else if ( "element".equals( name ) ) {
        SimpleValue elt = new SimpleValue( mappings, collection.getCollectionTable() );
        collection.setElement( elt );
        bindSimpleValue(
            subnode,
            elt,
            true,
View Full Code Here

        property.setNodeName( referencedProperty.getNodeName() );
        //FIXME set optional?
        //property.setOptional( property.isOptional() );
        property.setPersistentClass( component.getOwner() );
        property.setPropertyAccessorName( referencedProperty.getPropertyAccessorName() );
        SimpleValue value = new SimpleValue( mappings, component.getTable() );
        property.setValue( value );
        final SimpleValue referencedValue = (SimpleValue) referencedProperty.getValue();
        value.setTypeName( referencedValue.getTypeName() );
        value.setTypeParameters( referencedValue.getTypeParameters() );
        final Iterator<Selectable> columns = referencedValue.getColumnIterator();

        if ( joinColumns[0].isNameDeferred() ) {
          joinColumns[0].copyReferencedStructureAndCreateDefaultJoinColumns(
            referencedPersistentClass,
            columns,
View Full Code Here

    join.setPersistentClass( persistentClass );

    //no check constraints available on joins
    join.setTable( originalJoin.getTable() );
    join.setInverse( true );
    SimpleValue key = new DependantValue( mappings, join.getTable(), persistentClass.getIdentifier() );
    //TODO support @ForeignKey
    join.setKey( key );
    join.setSequentialSelect( false );
    //TODO support for inverse and optional
    join.setOptional( true ); //perhaps not quite per-spec, but a Good Thing anyway
    key.setCascadeDeleteEnabled( false );
    Iterator mappedByColumns = otherSideProperty.getValue().getColumnIterator();
    while ( mappedByColumns.hasNext() ) {
      Column column = (Column) mappedByColumns.next();
      Column copy = new Column();
      copy.setLength( column.getLength() );
      copy.setScale( column.getScale() );
      copy.setValue( key );
      copy.setName( column.getQuotedName() );
      copy.setNullable( column.isNullable() );
      copy.setPrecision( column.getPrecision() );
      copy.setUnique( column.isUnique() );
      copy.setSqlType( column.getSqlType() );
      copy.setCheckConstraint( column.getCheckConstraint() );
      copy.setComment( column.getComment() );
      copy.setDefaultValue( column.getDefaultValue() );
      key.addColumn( copy );
    }
    persistentClass.addJoin( join );
    return join;
  }
View Full Code Here

    validate();
    LOG.debugf( "building SimpleValue for %s", propertyName );
    if ( table == null ) {
      table = columns[0].getTable();
    }
    simpleValue = new SimpleValue( mappings, table );

    linkWithValue();

    boolean isInSecondPass = mappings.isInSecondPass();
    SetSimpleValueTypeSecondPass secondPass = new SetSimpleValueTypeSecondPass( this );
View Full Code Here

      else {
        throw new AnnotationException( "@CollectionId is missing type: "
            + StringHelper.qualify( propertyHolder.getPath(), propertyName ) );
      }
      simpleValue.setMappings( mappings );
      SimpleValue id = simpleValue.make();
      ( (IdentifierCollection) collection ).setIdentifier( id );
      String generator = collectionIdAnn.generator();
      String generatorType;
      if ( "identity".equals( generator ) || "assigned".equals( generator )
          || "sequence".equals( generator ) || "native".equals( generator ) ) {
View Full Code Here

TOP

Related Classes of org.hibernate.mapping.SimpleValue

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.