diff --git a/community/kernel/src/main/java/org/neo4j/kernel/impl/core/NodeProxy.java b/community/kernel/src/main/java/org/neo4j/kernel/impl/core/NodeProxy.java index 692bc9c946a54..2617a68572282 100644 --- a/community/kernel/src/main/java/org/neo4j/kernel/impl/core/NodeProxy.java +++ b/community/kernel/src/main/java/org/neo4j/kernel/impl/core/NodeProxy.java @@ -150,12 +150,8 @@ public ResourceIterable getRelationships( RelationshipType type, D @Override public ResourceIterable getRelationships( final Direction direction, RelationshipType... types ) { - final int[] typeIds; KernelTransaction transaction = safeAcquireTransaction(); - try ( Statement statement = transaction.acquireStatement() ) - { - typeIds = relTypeIds( types, statement ); - } + int[] typeIds = relTypeIds( types, transaction.tokenRead() ); return innerGetRelationships( transaction, direction, typeIds ); } @@ -187,12 +183,8 @@ public boolean hasRelationship( RelationshipType... types ) @Override public boolean hasRelationship( Direction direction, RelationshipType... types ) { - final int[] typeIds; KernelTransaction transaction = safeAcquireTransaction(); - try ( Statement statement = transaction.acquireStatement() ) - { - typeIds = relTypeIds( types, statement ); - } + int[] typeIds = relTypeIds( types, transaction.tokenRead() ); return innerHasRelationships( transaction, direction, typeIds ); } @@ -791,13 +783,13 @@ private ResourceIterator getRelationshipSelectionIterator( } } - private int[] relTypeIds( RelationshipType[] types, Statement statement ) + private int[] relTypeIds( RelationshipType[] types, TokenRead token ) { int[] ids = new int[types.length]; int outIndex = 0; for ( RelationshipType type : types ) { - int id = statement.readOperations().relationshipTypeGetForName( type.name() ); + int id = token.relationshipType( type.name() ); if ( id != NO_SUCH_RELATIONSHIP_TYPE ) { ids[outIndex++] = id;