Package javax.persistence

Examples of javax.persistence.JoinTable


    ManyToMany manyToMany = _field.getAnnotation(ManyToMany.class);
   
    if (manyToMany != null)
      introspectManyToMany(manyToMany);
   
    JoinTable joinTableAnn = _field.getAnnotation(JoinTable.class);

    if (joinTableAnn != null)
      setJoinTable(new JoinTableConfig(joinTableAnn));
  }
View Full Code Here


    OneToMany oneToMany = _field.getAnnotation(OneToMany.class);
   
    if (oneToMany != null)
      introspectOneToMany(oneToMany);
   
    JoinTable joinTableAnn = _field.getAnnotation(JoinTable.class);

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

   
View Full Code Here

                                          getCascade());
    manyToManyField.setType(targetType);

    String sqlTable = _sourceType.getTable().getName() + "_" + targetType.getTable().getName();

    JoinTable joinTableAnn = _field.getAnnotation(javax.persistence.JoinTable.class);

    JoinTableConfig joinTableConfig = getJoinTable();

    AmberTable mapTable = null;
View Full Code Here

    JoinColumns joinColumns = get(prop, JoinColumns.class);
    if (joinColumns != null) {
      prop.getTableJoin().addJoinColumn(true, joinColumns.value(), beanTable);
    }

    JoinTable joinTable = get(prop, JoinTable.class);
    if (joinTable != null) {
      if (prop.isManyToMany()){
        // expected this
        readJoinTable(joinTable, prop);

      } else {
        // OneToMany in theory
        prop.getTableJoin().addJoinColumn(true, joinTable.joinColumns(), beanTable);
      }
    }

    if (prop.getMappedBy() != null){
      // the join is derived by reversing the join information
View Full Code Here

   * These rules are here to support both JPA 2 and legacy overriding rules.
   */
  @Override
  public JoinTable getJoinTable(XProperty property) {
    final String propertyName = StringHelper.qualify( getPath(), property.getName() );
    JoinTable result = getOverriddenJoinTable( propertyName );
    if (result == null) {
      result = property.getAnnotation( JoinTable.class );
    }
    return result;
  }
View Full Code Here

   * replace the placeholder 'collection&&element' with nothing
   *
   * These rules are here to support both JPA 2 and legacy overriding rules.
   */
  public JoinTable getOverriddenJoinTable(String propertyName) {
    JoinTable result = getExactOverriddenJoinTable( propertyName );
    if ( result == null && propertyName.contains( ".collection&&element." ) ) {
      //support for non map collections where no prefix is needed
      //TODO cache the underlying regexp
      result = getExactOverriddenJoinTable( propertyName.replace( ".collection&&element.", "."  ) );
    }
View Full Code Here

  /**
   * Get column overriding, property first, then parent, then holder
   */
  private JoinTable getExactOverriddenJoinTable(String propertyName) {
    JoinTable override = null;
    if ( parent != null ) {
      override = parent.getExactOverriddenJoinTable( propertyName );
    }
    if ( override == null && currentPropertyJoinTableOverride != null ) {
      override = currentPropertyJoinTableOverride.get( propertyName );
View Full Code Here

    if ( defaultToJoinTable
        && ( StringHelper.isNotEmpty( defaults.getCatalog() )
        || StringHelper.isNotEmpty( defaults.getSchema() ) ) ) {
      AnnotationDescriptor ad = new AnnotationDescriptor( annotationType );
      if ( defaults.canUseJavaAnnotations() ) {
        JoinTable table = getJavaAnnotation( annotationType );
        if ( table != null ) {
          ad.setValue( "name", table.name() );
          ad.setValue( "schema", table.schema() );
          ad.setValue( "catalog", table.catalog() );
          ad.setValue( "uniqueConstraints", table.uniqueConstraints() );
          ad.setValue( "joinColumns", table.joinColumns() );
          ad.setValue( "inverseJoinColumns", table.inverseJoinColumns() );
        }
      }
      if ( StringHelper.isEmpty( (String) ad.valueOf( "schema" ) )
          && StringHelper.isNotEmpty( defaults.getSchema() ) ) {
        ad.setValue( "schema", defaults.getSchema() );
View Full Code Here

    if ( subelements != null && subelements.size() > 0 ) {
      for ( Element current : subelements ) {
        AnnotationDescriptor override = new AnnotationDescriptor( AssociationOverride.class );
        copyStringAttribute( override, current, "name", true );
        override.setValue( "joinColumns", getJoinColumns( current, false ) );
        JoinTable joinTable = buildJoinTable( current, defaults );
        if ( joinTable != null ) {
          override.setValue( "joinTable", joinTable );
        }
        overrides.add( (AssociationOverride) AnnotationFactory.create( override ) );
      }
View Full Code Here

    return this;
  }

  Ejb3JoinColumn[] buildDefaultJoinColumnsForXToOne(XProperty property, PropertyData inferredData) {
    Ejb3JoinColumn[] joinColumns;
    JoinTable joinTableAnn = propertyHolder.getJoinTable( property );
    if ( joinTableAnn != null ) {
      joinColumns = Ejb3JoinColumn.buildJoinColumns(
          joinTableAnn.inverseJoinColumns(), null, entityBinder.getSecondaryTables(),
          propertyHolder, inferredData.getPropertyName(), mappings
      );
      if ( StringHelper.isEmpty( joinTableAnn.name() ) ) {
        throw new AnnotationException(
            "JoinTable.name() on a @ToOne association has to be explicit: "
                + BinderHelper.getPath( propertyHolder, inferredData )
        );
      }
View Full Code Here

TOP

Related Classes of javax.persistence.JoinTable

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.