Examples of AmberPersistenceUnit


Examples of com.caucho.amber.manager.AmberPersistenceUnit

  }

  private void addManyToOne()
    throws ConfigException
  {
    AmberPersistenceUnit persistenceUnit = _sourceType.getPersistenceUnit();

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

    ManyToOneField manyToOneField;
    manyToOneField = new ManyToOneField(_sourceType, _fieldName,
                                        getCascade(), false);
View Full Code Here

Examples of com.caucho.amber.manager.AmberPersistenceUnit

    manyToOneField.init();
  }

  private void addDependentOneToOne()
  {
    AmberPersistenceUnit persistenceUnit = _sourceType.getPersistenceUnit();

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

    // Owner
    ManyToOneField sourceField
      = getSourceField(targetType, _mappedBy, _sourceType);
View Full Code Here

Examples of com.caucho.amber.manager.AmberPersistenceUnit

                  String fieldName,
                  Class fieldType,
                  VersionConfig versionConfig)
    throws ConfigException
  {
    AmberPersistenceUnit persistenceUnit = sourceType.getPersistenceUnit();

    Column columnAnn = field.getAnnotation(Column.class);

    ColumnConfig columnConfig = null;

    if (versionConfig != null)
      columnConfig = versionConfig.getColumn();

    if (! _versionTypes.contains(fieldType.getName())) {
      throw error(field, L.l("{0} is an invalid @Version type for {1}.",
                             fieldType.getName(), fieldName));
    }

    AmberType amberType = persistenceUnit.createType(fieldType);

    AmberColumn fieldColumn = createColumn(sourceType, field, fieldName,
                                      columnAnn, amberType, columnConfig);

    VersionField version = new VersionField(sourceType, fieldName);
View Full Code Here

Examples of com.caucho.amber.manager.AmberPersistenceUnit

      }
      else if (attributeOverridesAnn != null) {
        attOverridesAnn = attributeOverridesAnn.value();
      }

      AmberPersistenceUnit persistenceUnit = _entityType.getPersistenceUnit();

      EmbeddableType type = persistenceUnit.createEmbeddable(_fieldType);

      EntityEmbeddedField embeddedField;

      if (_embeddedId) {
        embeddedField = _entityType.getId().getEmbeddedIdField();
View Full Code Here

Examples of com.caucho.amber.manager.AmberPersistenceUnit

  }
 
  @Override
  public void complete()
  {
    AmberPersistenceUnit persistenceUnit = _sourceType.getPersistenceUnit();

    Class targetEntity = getTargetEntity();

    if (targetEntity == null)
      throw error(_field, L.l("Can't determine targetEntity for {0}.  @OneToMany properties must target @Entity beans.",
                              _fieldName));

    EntityType targetType = persistenceUnit.getEntityType(targetEntity);
     
    if (targetType == null) {
      throw error(_field,
                  L.l("targetEntity '{0}' is not an @Entity bean for {1}.  The targetEntity of a @OneToMany collection must be an @Entity bean.",
                      targetEntity.getName(),
View Full Code Here

Examples of com.caucho.amber.manager.AmberPersistenceUnit

    AmberTable mapTable = null;

    ArrayList<ForeignColumn> sourceColumns = null;
    ArrayList<ForeignColumn> targetColumns = null;
    AmberPersistenceUnit persistenceUnit = _sourceType.getPersistenceUnit();

    if (joinTableConfig != null) {
      HashMap<String, JoinColumnConfig> joinColumnsConfig = null;
      HashMap<String, JoinColumnConfig> inverseJoinColumnsConfig = null;

      if (! joinTableConfig.getName().equals(""))
        sqlTable = joinTableConfig.getName();

      joinColumnsConfig = joinTableConfig.getJoinColumnMap();
      inverseJoinColumnsConfig = joinTableConfig.getInverseJoinColumnMap();
      mapTable = persistenceUnit.createTable(sqlTable);

      sourceColumns
        = calculateColumns(_field, _fieldName, mapTable,
                           _sourceType.getTable().getName() + "_",
                           _sourceType,
                           joinColumnsConfig);

      targetColumns = calculateColumns(_field, _fieldName, mapTable,
                                       targetType.getTable().getName() + "_",
                                       targetType,
                                       inverseJoinColumnsConfig);
    }
    else {
      mapTable = persistenceUnit.createTable(sqlTable);

      sourceColumns = calculateColumns(mapTable,
                                       _sourceType.getTable().getName() + "_",
                                       _sourceType);
View Full Code Here

Examples of com.caucho.amber.manager.AmberPersistenceUnit

      }

      term.append(_column.getName());
    }

    AmberPersistenceUnit manager = _column.getTable().getAmberManager();

    JdbcMetaData metaData = manager.getMetaData();

    cb.append(metaData.generateBoolean(term.toString()));
  }
View Full Code Here

Examples of com.caucho.amber.manager.AmberPersistenceUnit

  }
 
  @Override
  public void complete()
  {
    AmberPersistenceUnit persistenceUnit = _sourceType.getPersistenceUnit();

    Class targetClass = getTargetClass();

    if (targetClass == null || void.class.equals(targetClass))
      throw error(_field, L.l("Can't determine targetEntity for {0}.  @OneToMany properties must target @Entity beans.",
            _fieldName));

    AmberType targetType = persistenceUnit.createType(targetClass);
     
    if (targetType == null) {
      throw error(_field,
      L.l("targetClass '{0}' is not a known element collection class for {1}.  The targetClass of a @ElementCollection must be a basic class.",
          targetClass.getName(),
View Full Code Here

Examples of com.caucho.amber.manager.AmberPersistenceUnit

    eltCollectionField.setType(targetType);
    eltCollectionField.setLazy(isFetchLazy());

    CollectionTableConfig collectionTableConfig = _collectionTable;
    AmberPersistenceUnit persistenceUnit = _sourceType.getPersistenceUnit();

    String sqlTable = collectionTableConfig.getName();
    AmberTable mapTable = persistenceUnit.createTable(sqlTable);

    HashMap<String, JoinColumnConfig> joinColumnsConfig
      = collectionTableConfig.getJoinColumnMap();

    ArrayList<ForeignColumn> sourceColumns = null;
View Full Code Here

Examples of com.caucho.amber.manager.AmberPersistenceUnit

                  String fieldName,
                  Class fieldType,
                  VersionConfig versionConfig)
    throws ConfigException
  {
    AmberPersistenceUnit persistenceUnit = sourceType.getPersistenceUnit();

    Column columnAnn = field.getAnnotation(Column.class);

    ColumnConfig columnConfig = null;

    if (versionConfig != null)
      columnConfig = versionConfig.getColumn();

    if (! _versionTypes.contains(fieldType.getName())) {
      throw error(field, L.l("{0} is an invalid @Version type for {1}.",
                             fieldType.getName(), fieldName));
    }

    AmberType amberType = persistenceUnit.createType(fieldType);

    AmberColumn fieldColumn = createColumn(sourceType, field, fieldName,
                                      columnAnn, amberType, columnConfig);

    VersionField version = new VersionField(sourceType, fieldName);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.