collection.setInverse( isMappedBy );
private void bindCollectionMetadata(MappingDocument mappingDocument, PluralAttributeSource source, Collection binding) { binding.setRole( source.getAttributeRole().getFullPath() ); binding.setInverse( source.isInverse() ); binding.setMutable( source.isMutable() ); binding.setOptimisticLocked( source.isIncludedInOptimisticLocking() );
collection.setInverse( isMappedBy );
/** * Links a bidirectional one-to-many, configuring the inverse side and using a column copy to perform the link * * @param collection The collection one-to-many * @param associatedClass The associated class * @param key The key * @param otherSide The other side of the relationship */ protected void linkBidirectionalOneToMany(Collection collection, PersistentClass associatedClass, DependantValue key, PersistentProperty otherSide) { collection.setInverse(true); // Iterator mappedByColumns = associatedClass.getProperty(otherSide.getName()).getValue().getColumnIterator(); Iterator<?> mappedByColumns = getProperty(associatedClass, otherSide.getName()).getValue().getColumnIterator(); while (mappedByColumns.hasNext()) { Column column = (Column) mappedByColumns.next(); linkValueUsingAColumnCopy(otherSide, column, key); } }
/** * Links a bidirectional one-to-many, configuring the inverse side and using a column copy to perform the link * * @param collection The collection one-to-many * @param associatedClass The associated class * @param key The key * @param otherSide The other side of the relationship */ private static void linkBidirectionalOneToMany(Collection collection, PersistentClass associatedClass, DependantValue key, GrailsDomainClassProperty otherSide) { collection.setInverse(true); // Iterator mappedByColumns = associatedClass.getProperty(otherSide.getName()).getValue().getColumnIterator(); Iterator<?> mappedByColumns = getProperty(associatedClass, otherSide.getName()).getValue().getColumnIterator(); while (mappedByColumns.hasNext()) { Column column = (Column) mappedByColumns.next(); linkValueUsingAColumnCopy(otherSide, column, key); } }
collection.setInverse( "true".equals( inverseNode.getValue() ) );
collection.setInverse( "true".equals( inverseNode.getValue() ) );
collection.setInverse( "true".equals( inverseNode.getValue() ) );
/** * Binds a unidirectional one-to-many creating a psuedo back reference property in the process. * * @param property * @param mappings * @param collection */ protected void bindUnidirectionalOneToMany(org.grails.datastore.mapping.model.types.OneToMany property, Mappings mappings, Collection collection) { Value v = collection.getElement(); v.createForeignKey(); String entityName; if (v instanceof ManyToOne) { ManyToOne manyToOne = (ManyToOne) v; entityName = manyToOne.getReferencedEntityName(); } else { entityName = ((OneToMany) v).getReferencedEntityName(); } collection.setInverse(false); PersistentClass referenced = mappings.getClass(entityName); Backref prop = new Backref(); PersistentEntity owner = property.getOwner(); prop.setEntityName(owner.getName()); prop.setName(UNDERSCORE + addUnderscore(owner.getJavaClass().getSimpleName(), property.getName()) + "Backref"); prop.setUpdateable(false); prop.setInsertable(true); prop.setCollectionRole(collection.getRole()); prop.setValue(collection.getKey()); prop.setOptional(true); referenced.addProperty(prop); }
collection.setInverse( isMappedBy ); String collType = getCollectionType().getName();
bindCollectionForPropertyConfig(collection, propConfig); if (property.isCircular()) { collection.setInverse(false);
collection.setInverse(true);
/** * Binds a unidirectional one-to-many creating a psuedo back reference property in the process. * * @param property * @param mappings * @param collection */ private static void bindUnidirectionalOneToMany(GrailsDomainClassProperty property, Mappings mappings, Collection collection) { Value v = collection.getElement(); v.createForeignKey(); String entityName; if (v instanceof ManyToOne) { ManyToOne manyToOne = (ManyToOne) v; entityName = manyToOne.getReferencedEntityName(); } else { entityName = ((OneToMany) v).getReferencedEntityName(); } collection.setInverse(false); PersistentClass referenced = mappings.getClass(entityName); Backref prop = new Backref(); prop.setEntityName(property.getDomainClass().getFullName()); prop.setName(UNDERSCORE + addUnderscore(property.getDomainClass().getShortName(), property.getName()) + "Backref"); prop.setUpdateable(false); prop.setInsertable(true); prop.setCollectionRole(collection.getRole()); prop.setValue(collection.getKey()); prop.setOptional(true); referenced.addProperty(prop); }
collection.setInverse(collectionInverse); // TODO: allow overriding this collection.setLazy(collectionLazy); collection.setFetchMode(FetchMode.SELECT);
collection.setInverse(collectionInverse); // TODO: allow overriding this collection.setLazy(collectionLazy); collection.setFetchMode(FetchMode.SELECT);
collection.setInverse(true);
collection.setInverse( isMappedBy );
bindUnidirectionalOneToManyInverseValues(property, (ManyToOne) element); collection.setInverse(false);
private void bindCollectionMetadata(MappingDocument mappingDocument, PluralAttributeSource source, Collection binding) { binding.setRole( source.getAttributeRole().getFullPath() ); binding.setInverse( source.isInverse() ); binding.setMutable( source.isMutable() ); binding.setOptimisticLocked( source.isIncludedInOptimisticLocking() );
bindUnidirectionalOneToManyInverseValues(property, (ManyToOne) element); collection.setInverse(false);