HHH-7549 @OneToMany support
This commit is contained in:
parent
5cdce758a8
commit
289866968b
|
@ -116,39 +116,6 @@ public abstract class AbstractPluralAttributeBinding extends AbstractAttributeBi
|
|||
}
|
||||
}
|
||||
|
||||
// protected void initializeBinding(PluralAttributeBindingState state) {
|
||||
// super.initialize( state );
|
||||
// fetchMode = state.getFetchMode();
|
||||
// extraLazy = state.isExtraLazy();
|
||||
// pluralAttributeElementBinding.setNodeName( state.getElementNodeName() );
|
||||
// pluralAttributeElementBinding.setTypeName( state.getElementTypeName() );
|
||||
// mutable = state.isMutable();
|
||||
// subselectLoadable = state.isSubselectLoadable();
|
||||
// if ( isSubselectLoadable() ) {
|
||||
// getEntityBinding().setSubselectLoadableCollections( true );
|
||||
// }
|
||||
// cacheConcurrencyStrategy = state.getCacheConcurrencyStrategy();
|
||||
// cacheRegionName = state.getCacheRegionName();
|
||||
// orderBy = state.getOrderBy();
|
||||
// where = state.getWhere();
|
||||
// referencedPropertyName = state.getReferencedPropertyName();
|
||||
// sorted = state.isSorted();
|
||||
// comparator = state.getComparator();
|
||||
// comparatorClassName = state.getComparatorClassName();
|
||||
// orphanDelete = state.isOrphanDelete();
|
||||
// batchSize = state.getBatchSize();
|
||||
// embedded = state.isEmbedded();
|
||||
// optimisticLocked = state.isOptimisticLocked();
|
||||
// collectionPersisterClass = state.getCollectionPersisterClass();
|
||||
// filters.putAll( state.getFilters() );
|
||||
// synchronizedTables.addAll( state.getSynchronizedTables() );
|
||||
// customSQLInsert = state.getCustomSQLInsert();
|
||||
// customSQLUpdate = state.getCustomSQLUpdate();
|
||||
// customSQLDelete = state.getCustomSQLDelete();
|
||||
// customSQLDeleteAll = state.getCustomSQLDeleteAll();
|
||||
// loaderName = state.getLoaderName();
|
||||
// }
|
||||
|
||||
@Override
|
||||
public PluralAttribute getAttribute() {
|
||||
return (PluralAttribute) super.getAttribute();
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
*/
|
||||
package org.hibernate.metamodel.spi.binding;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.hibernate.AssertionFailure;
|
||||
import org.hibernate.metamodel.spi.relational.Column;
|
||||
import org.hibernate.metamodel.spi.relational.ForeignKey;
|
||||
|
@ -38,7 +40,6 @@ public class PluralAttributeKeyBinding {
|
|||
|
||||
private ForeignKey foreignKey;
|
||||
private boolean inverse;
|
||||
// may need notion of "boolean updatable"
|
||||
|
||||
// this knowledge can be implicitly resolved based on the typing information on the referenced owner attribute
|
||||
private final HibernateTypeDescriptor hibernateTypeDescriptor = new HibernateTypeDescriptor();
|
||||
|
@ -125,4 +126,14 @@ public class PluralAttributeKeyBinding {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isUpdatable() {
|
||||
List<RelationalValueBinding> valueBindings = referencedAttributeBinding.getRelationalValueBindings();
|
||||
for(final RelationalValueBinding valueBinding : valueBindings){
|
||||
if(valueBinding.isIncludeInUpdate()){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -257,8 +257,8 @@ public abstract class AbstractCollectionPersister
|
|||
this.cacheAccessStrategy = cacheAccessStrategy;
|
||||
if ( factory.getSettings().isStructuredCacheEntriesEnabled() ) {
|
||||
cacheEntryStructure = collection.isMap() ?
|
||||
(CacheEntryStructure) new StructuredMapCacheEntry() :
|
||||
(CacheEntryStructure) new StructuredCollectionCacheEntry();
|
||||
new StructuredMapCacheEntry() :
|
||||
new StructuredCollectionCacheEntry();
|
||||
}
|
||||
else {
|
||||
cacheEntryStructure = new UnstructuredCacheEntry();
|
||||
|
|
|
@ -83,7 +83,7 @@ public class OneToManyPersister extends AbstractCollectionPersister {
|
|||
public boolean isCascadeDeleteEnabled() {
|
||||
return cascadeDeleteEnabled;
|
||||
}
|
||||
|
||||
@SuppressWarnings( {"UnusedDeclaration"})
|
||||
public OneToManyPersister(
|
||||
Collection collection,
|
||||
CollectionRegionAccessStrategy cacheAccessStrategy,
|
||||
|
@ -95,7 +95,7 @@ public class OneToManyPersister extends AbstractCollectionPersister {
|
|||
keyIsNullable = collection.getKey().isNullable();
|
||||
keyIsUpdateable = collection.getKey().isUpdateable();
|
||||
}
|
||||
|
||||
@SuppressWarnings( {"UnusedDeclaration"})
|
||||
public OneToManyPersister(
|
||||
AbstractPluralAttributeBinding collection,
|
||||
CollectionRegionAccessStrategy cacheAccessStrategy,
|
||||
|
@ -117,9 +117,7 @@ public class OneToManyPersister extends AbstractCollectionPersister {
|
|||
final SingularAttributeBinding referencedAttributeBinding =
|
||||
keyBinding.getReferencedAttributeBinding();
|
||||
keyIsNullable = keyBinding.isNullable();
|
||||
// TODO: fix this...
|
||||
//keyIsUpdateable = referencedAttributeBinding.isUpdateable();
|
||||
keyIsUpdateable = true;
|
||||
keyIsUpdateable = keyBinding.isUpdatable();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue