Package org.hibernate.mapping

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


        " -> " + 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

      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

      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

    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

      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

    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

          keyVal = collection.getOwner().getIdentifier();
        }
        else {
          keyVal = (KeyValue) collection.getOwner().getRecursiveProperty( propRef ).getValue();
        }
        SimpleValue key = new DependantValue( 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( collection.getCollectionTable() );
        collection.setElement( elt );
        bindSimpleValue(
            subnode,
            elt,
            true,
View Full Code Here

    if ( identifier instanceof Component ) {

      wholeString.append( AnnotationBuilder.createAnnotation( importType("javax.persistence.EmbeddedId") ).getResult());
    }
    else if ( identifier instanceof SimpleValue ) {
      SimpleValue simpleValue = (SimpleValue) identifier;
      strategy = simpleValue.getIdentifierGeneratorStrategy();
      properties = c2j.getFilteredIdentifierGeneratorProperties(simpleValue);
      StringBuffer idResult = new StringBuffer();
      AnnotationBuilder builder = AnnotationBuilder.createAnnotation( importType("javax.persistence.Id") );
      idResult.append(builder.getResult());
      idResult.append(" ");
View Full Code Here

  }

  protected boolean isAssignedIdentifier(PersistentClass pc, Property property) {
    if(property.equals(pc.getIdentifierProperty())) {
      if(property.getValue().isSimpleValue()) {
        SimpleValue sv = (SimpleValue) property.getValue();
        if("assigned".equals(sv.getIdentifierGeneratorStrategy())) {
          return true;
        }
      }
    }
    return false;
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.