Merge pull request #1 from akarsh-jain/akarsh-jain-patch-1
Revert changes to isolate cyclic entity (HHH-13068) fixes
This commit is contained in:
commit
d7a2e24aab
|
@ -1261,7 +1261,6 @@ public class ActionQueue {
|
|||
ClassMetadata classMetadata = action.getPersister().getClassMetadata();
|
||||
if ( classMetadata != null ) {
|
||||
Type[] propertyTypes = classMetadata.getPropertyTypes();
|
||||
Type identifierType = classMetadata.getIdentifierType();
|
||||
|
||||
for ( int i = 0; i < propertyValues.length; i++ ) {
|
||||
Object value = propertyValues[i];
|
||||
|
@ -1269,27 +1268,17 @@ public class ActionQueue {
|
|||
addParentChildEntityNameByPropertyAndValue( action, batchIdentifier, type, value );
|
||||
}
|
||||
|
||||
if ( identifierType.isComponentType() ) {
|
||||
CompositeType compositeType = (CompositeType) identifierType;
|
||||
Type[] compositeIdentifierTypes = compositeType.getSubtypes();
|
||||
|
||||
for ( Type type : compositeIdentifierTypes ) {
|
||||
addParentChildEntityNameByPropertyAndValue( action, batchIdentifier, type, null );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addParentChildEntityNameByPropertyAndValue(AbstractEntityInsertAction action, BatchIdentifier batchIdentifier, Type type, Object value) {
|
||||
if ( type.isEntityType() ) {
|
||||
if ( type.isEntityType() && value != null ) {
|
||||
final EntityType entityType = (EntityType) type;
|
||||
final String entityName = entityType.getName();
|
||||
final String rootEntityName = action.getSession().getFactory().getMetamodel().entityPersister( entityName ).getRootEntityName();
|
||||
|
||||
if ( entityType.isOneToOne() && OneToOneType.class.cast( entityType ).getForeignKeyDirection() == ForeignKeyDirection.TO_PARENT ) {
|
||||
if ( !entityType.isReferenceToPrimaryKey() ) {
|
||||
batchIdentifier.getChildEntityNames().add( entityName );
|
||||
}
|
||||
if ( !rootEntityName.equals( entityName ) ) {
|
||||
batchIdentifier.getChildEntityNames().add( rootEntityName );
|
||||
}
|
||||
|
@ -1298,23 +1287,20 @@ public class ActionQueue {
|
|||
if ( !batchIdentifier.getEntityName().equals( entityName ) ) {
|
||||
batchIdentifier.getParentEntityNames().add( entityName );
|
||||
}
|
||||
if ( value != null ) {
|
||||
String valueClass = value.getClass().getName();
|
||||
if ( !valueClass.equals( entityName ) ) {
|
||||
batchIdentifier.getParentEntityNames().add( valueClass );
|
||||
}
|
||||
}
|
||||
if ( !rootEntityName.equals( entityName ) ) {
|
||||
batchIdentifier.getParentEntityNames().add( rootEntityName );
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( type.isCollectionType() ) {
|
||||
else if ( type.isCollectionType() && value != null ) {
|
||||
CollectionType collectionType = (CollectionType) type;
|
||||
final SessionFactoryImplementor sessionFactory = ( (SessionImplementor) action.getSession() )
|
||||
.getSessionFactory();
|
||||
if ( collectionType.getElementType( sessionFactory ).isEntityType() &&
|
||||
!sessionFactory.getMetamodel().collectionPersister( collectionType.getRole() ).isManyToMany() ) {
|
||||
if ( collectionType.getElementType( sessionFactory ).isEntityType() ) {
|
||||
String entityName = collectionType.getAssociatedEntityName( sessionFactory );
|
||||
String rootEntityName = action.getSession().getFactory().getMetamodel().entityPersister( entityName ).getRootEntityName();
|
||||
batchIdentifier.getChildEntityNames().add( entityName );
|
||||
|
|
Loading…
Reference in New Issue