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()); } } } }
public int getColumnSpan() { return associatedClass.getKey().getColumnSpan(); }
public Iterator<Selectable> getColumnIterator() { return associatedClass.getKey().getColumnIterator(); }
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(); }
public Component(PersistentClass owner) throws MappingException { super(owner.getTable()); this.owner = owner; }