示例#1
0
  public void createPropertyRefConstraints(Map persistentClasses) {
    if (referencedPropertyName != null) {
      PersistentClass pc = (PersistentClass) persistentClasses.get(getReferencedEntityName());

      Property property = pc.getReferencedProperty(getReferencedPropertyName());

      if (property == null) {
        throw new MappingException(
            "Could not find property "
                + getReferencedPropertyName()
                + " on "
                + getReferencedEntityName());
      } else {
        if (!hasFormula() && !"none".equals(getForeignKeyName())) {
          java.util.List refColumns = new ArrayList();
          Iterator iter = property.getColumnIterator();
          while (iter.hasNext()) {
            Column col = (Column) iter.next();
            refColumns.add(col);
          }

          ForeignKey fk =
              getTable()
                  .createForeignKey(
                      getForeignKeyName(),
                      getConstraintColumns(),
                      ((EntityType) getType()).getAssociatedEntityName(),
                      refColumns);
          fk.setCascadeDeleteEnabled(isCascadeDeleteEnabled());
        }
      }
    }
  }
示例#2
0
 public int getColumnSpan() {
   return associatedClass.getKey().getColumnSpan();
 }
示例#3
0
 public Iterator<Selectable> getColumnIterator() {
   return associatedClass.getKey().getColumnIterator();
 }
示例#4
0
 public OneToMany(MetadataImplementor metadata, PersistentClass owner) throws MappingException {
   this.metadata = metadata;
   this.referencingTable = (owner == null) ? null : owner.getTable();
 }
 public OneToOne(Mappings mappings, Table table, PersistentClass owner) throws MappingException {
   super(mappings, table);
   this.identifier = owner.getKey();
   this.entityName = owner.getEntityName();
 }
示例#6
0
 public Component(PersistentClass owner) throws MappingException {
   super(owner.getTable());
   this.owner = owner;
 }