Package com.caucho.amber.field

Examples of com.caucho.amber.field.ManyToOneField


  {
    AmberPersistenceUnit persistenceUnit = _sourceType.getPersistenceUnit();

    String targetName = _fieldType.getName();

    ManyToOneField manyToOneField;
    manyToOneField = new ManyToOneField(_sourceType, _fieldName, getCascade(), true);

    EntityType targetType = persistenceUnit.createEntity(getTargetEntity());

    manyToOneField.setType(targetType);

    manyToOneField.setLazy(isFetchLazy());

    if (_joinColumnMap.size() > 0)
      manyToOneField.setJoinColumnMap(_joinColumnMap);

    _sourceType.addField(manyToOneField);

    // jpa/0ge3
    if (_sourceType instanceof MappedSuperclassType)
      return;

    if (_joinColumnMap.size() > 0)
      validateJoinColumns(_field, _fieldName, _joinColumnMap, targetType);

    manyToOneField.init();
  }
View Full Code Here


  {
    AmberPersistenceUnit persistenceUnit = _sourceType.getPersistenceUnit();

    EntityType targetType = persistenceUnit.createEntity(getTargetEntity());

    ManyToOneField manyToOneField;
    manyToOneField = new ManyToOneField(_sourceType, _fieldName,
                                        getCascade(), false);

    manyToOneField.setType(targetType);

    manyToOneField.setLazy(isFetchLazy());

    manyToOneField.setJoinColumnMap(_joinColumnMap);

    _sourceType.addField(manyToOneField);

    // jpa/0ge3
    if (_sourceType instanceof MappedSuperclassType)
      return;

    validateJoinColumns(_field, _fieldName, _joinColumnMap, targetType);

    manyToOneField.init();
  }
View Full Code Here

    AmberPersistenceUnit persistenceUnit = _sourceType.getPersistenceUnit();

    EntityType targetType = persistenceUnit.createEntity(getTargetEntity());

    // Owner
    ManyToOneField sourceField
      = getSourceField(targetType, _mappedBy, _sourceType);

    if (sourceField == null) {
      throw error(_field, L.l("OneToOne target '{0}' does not have a matching ManyToOne relation.",
                              targetType.getName()));
    }

    DependentEntityOneToOneField oneToOne;

    oneToOne = new DependentEntityOneToOneField(_sourceType, _fieldName, getCascade());
    oneToOne.setTargetField(sourceField);
    sourceField.setTargetField(oneToOne);
    oneToOne.setLazy(isFetchLazy());

    _sourceType.addField(oneToOne);
  }
View Full Code Here

                      _fieldName));
    }
     
    String mappedBy = getMappedBy();

    ManyToOneField sourceField = getSourceField(targetType,
                                                mappedBy,
                                                null);

    if (sourceField == null)
      throw error(_field, L.l("'{1}' is an unknown column in '{0}' for @ManyToOne(mappedBy={1}).",
View Full Code Here

  {
    AmberPersistenceUnit persistenceUnit = _sourceType.getPersistenceUnit();

    String targetName = _fieldType.getName();

    ManyToOneField manyToOneField;
    manyToOneField = new ManyToOneField(_sourceType, _fieldName, getCascade(), true);

    EntityType targetType = persistenceUnit.createEntity(getTargetEntity());

    manyToOneField.setType(targetType);

    manyToOneField.setLazy(isFetchLazy());

    if (_joinColumnMap.size() > 0)
      manyToOneField.setJoinColumnMap(_joinColumnMap);

    _sourceType.addField(manyToOneField);

    // jpa/0ge3
    if (_sourceType instanceof MappedSuperclassType)
      return;

    if (_joinColumnMap.size() > 0)
      validateJoinColumns(_field, _fieldName, _joinColumnMap, targetType);

    manyToOneField.init();
  }
View Full Code Here

  {
    AmberPersistenceUnit persistenceUnit = _sourceType.getPersistenceUnit();

    EntityType targetType = persistenceUnit.createEntity(getTargetEntity());

    ManyToOneField manyToOneField;
    manyToOneField = new ManyToOneField(_sourceType, _fieldName,
          getCascade(), false);

    manyToOneField.setType(targetType);

    manyToOneField.setLazy(isFetchLazy());

    manyToOneField.setJoinColumnMap(_joinColumnMap);

    _sourceType.addField(manyToOneField);

    // jpa/0ge3
    if (_sourceType instanceof MappedSuperclassType)
      return;

    validateJoinColumns(_field, _fieldName, _joinColumnMap, targetType);

    manyToOneField.init();
  }
View Full Code Here

    AmberPersistenceUnit persistenceUnit = _sourceType.getPersistenceUnit();

    EntityType targetType = persistenceUnit.createEntity(getTargetEntity());

    // Owner
    ManyToOneField sourceField
      = getSourceField(targetType, _mappedBy, _sourceType);

    if (sourceField == null) {
      throw error(_field, L.l("OneToOne target '{0}' does not have a matching ManyToOne relation.",
            targetType.getName()));
    }

    DependentEntityOneToOneField oneToOne;

    oneToOne = new DependentEntityOneToOneField(_sourceType, _fieldName, getCascade());
    oneToOne.setTargetField(sourceField);
    sourceField.setTargetField(oneToOne);
    oneToOne.setLazy(isFetchLazy());

    _sourceType.addField(oneToOne);
  }
View Full Code Here

          _fieldName));
    }
     
    String mappedBy = getMappedBy();

    ManyToOneField sourceField = getSourceField(targetType,
            mappedBy,
            null);

    if (sourceField == null)
      throw error(_field, L.l("'{1}' is an unknown column in '{0}' for @ManyToOne(mappedBy={1}).",
View Full Code Here

TOP

Related Classes of com.caucho.amber.field.ManyToOneField

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.