Package javax.persistence

Examples of javax.persistence.JoinColumn


    ManyToOne manyToOne = _field.getAnnotation(ManyToOne.class);
   
    if (manyToOne != null)
      introspectManyToOne(manyToOne);
   
    JoinColumn joinColumnAnn = _field.getAnnotation(JoinColumn.class);
    JoinColumns joinColumnsAnn = _field.getAnnotation(JoinColumns.class);

    if (joinColumnsAnn != null && joinColumnAnn != null) {
      throw error(_field, L.l("{0} may not have both @JoinColumn and @JoinColumns",
                             _fieldName));
View Full Code Here


    ArrayList<ForeignColumn> columns = new ArrayList<ForeignColumn>();

    for (int i = 0; i < joinColumns.length; i++) {
      ForeignColumn foreignColumn;
      JoinColumn joinColumn = joinColumns[i];

      foreignColumn =
        mapTable.createForeignColumn(joinColumn.name(),
                                     type.getId().getKey().getColumns().get(0));

      columns.add(foreignColumn);
    }
View Full Code Here

    OneToOne oneToOne = _field.getAnnotation(OneToOne.class);
   
    if (oneToOne != null)
      introspectOneToOne(oneToOne);
   
    JoinColumn joinColumnAnn = _field.getAnnotation(JoinColumn.class);
    JoinColumns joinColumnsAnn = _field.getAnnotation(JoinColumns.class);

    if (joinColumnsAnn != null && joinColumnAnn != null) {
      throw error(_field, L.l("{0} may not have both @JoinColumn and @JoinColumns",
                             _fieldName));
View Full Code Here

          nullable = joinColumn.isNullable();
          unique = joinColumn.isUnique();
        }
      }
      else {
        JoinColumn joinAnn
          = BaseConfigIntrospector.getJoinColumn(_joinColumnsAnn,
                                                 keyColumn.getName());

        if (joinAnn != null) {
          columnName = joinAnn.name();

          nullable = joinAnn.nullable();
          unique = joinAnn.unique();
        }
      }

      ForeignColumn foreignColumn;
View Full Code Here

    if (joinTableAnn != null)
      setJoinTable(new JoinTableConfig(joinTableAnn));

   
    JoinColumn joinColumnAnn = _field.getAnnotation(JoinColumn.class);
    JoinColumns joinColumnsAnn = _field.getAnnotation(JoinColumns.class);

    if (joinColumnsAnn != null && joinColumnAnn != null) {
      throw error(_field, L.l("{0} may not have both @JoinColumn and @JoinColumns",
                             _fieldName));
View Full Code Here

      prop.setExtraWhere(where.clause());
    }

    // check for manually defined joins
    BeanTable beanTable = prop.getBeanTable();
    JoinColumn joinColumn = get(prop, JoinColumn.class);
    if (joinColumn != null) {
      prop.getTableJoin().addJoinColumn(true, joinColumn, beanTable);
    }

    JoinColumns joinColumns = get(prop, JoinColumns.class);
View Full Code Here

      };
    }
    else {
      joinColumns = new Ejb3JoinColumn[annJoins.length];
      JoinColumn annJoin;
      int length = annJoins.length;
      for (int index = 0; index < length; index++) {
        annJoin = annJoins[index];
        Ejb3JoinColumn currentJoinColumn = new Ejb3JoinColumn();
        currentJoinColumn.setImplicit( true );
View Full Code Here

        column.setInsertable( false );
        column.setUpdatable( false );
      }
    }
   
    final JoinColumn joinColumn = property.getAnnotation( JoinColumn.class );

    //Make sure that JPA1 key-many-to-one columns are read only tooj
    boolean hasSpecjManyToOne=false;
    if ( mappings.isSpecjProprietarySyntaxEnabled() ) {
      String columnName = "";
      for ( XProperty prop : inferredData.getDeclaringClass()
          .getDeclaredProperties( AccessType.FIELD.getType() ) ) {
        if ( prop.isAnnotationPresent( Id.class ) && prop.isAnnotationPresent( Column.class ) ) {
          columnName = prop.getAnnotation( Column.class ).name();
        }

        if ( property.isAnnotationPresent( ManyToOne.class ) && joinColumn != null
            && ! BinderHelper.isEmptyAnnotationValue( joinColumn.name() )
            && joinColumn.name().equals( columnName )
            && !property.isAnnotationPresent( MapsId.class ) ) {
           hasSpecjManyToOne = true;
          for ( Ejb3JoinColumn column : columns ) {
            column.setInsertable( false );
            column.setUpdatable( false );
          }
        }
      }

    }
    value.setTypeName( inferredData.getClassOrElementName() );
    final String propertyName = inferredData.getPropertyName();
    value.setTypeUsingReflection( propertyHolder.getClassName(), propertyName );
   
    String fkName = null;
    if ( joinColumn != null && joinColumn.foreignKey() != null ) {
      fkName = joinColumn.foreignKey().name();
    }
    if ( StringHelper.isEmpty( fkName ) ) {
      ForeignKey fk = property.getAnnotation( ForeignKey.class );
      fkName = fk != null ? fk.name() : "";
    }
View Full Code Here

      };
    }
    else {
      joinColumns = new Ejb3JoinColumn[annJoins.length];
      JoinColumn annJoin;
      int length = annJoins.length;
      for (int index = 0; index < length; index++) {
        annJoin = annJoins[index];
        Ejb3JoinColumn currentJoinColumn = new Ejb3JoinColumn();
        currentJoinColumn.setImplicit( true );
View Full Code Here

      };
    }
    else {
      joinColumns = new Ejb3JoinColumn[annJoins.length];
      JoinColumn annJoin;
      int length = annJoins.length;
      for (int index = 0; index < length; index++) {
        annJoin = annJoins[index];
        Ejb3JoinColumn currentJoinColumn = new Ejb3JoinColumn();
        currentJoinColumn.setImplicit( true );
View Full Code Here

TOP

Related Classes of javax.persistence.JoinColumn

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.