public EntityState<Node> getEntityState(final Object entity, boolean detachable, Neo4jTemplate template) {
final Class<?> entityType = entity.getClass();
if (isPartial(entityType)) {
Neo4jPersistentEntity<Object> persistentEntity = getPersistentEntity(entityType);
if (persistentEntity==null) return null;
final DelegatingFieldAccessorFactory fieldAccessorFactory = crossStoreFactory.provideFactoryFor(template);
@SuppressWarnings("unchecked") final CrossStoreNodeEntityState<NodeBacked> partialNodeEntityState =
new CrossStoreNodeEntityState<NodeBacked>(null, (NodeBacked)entity, (Class<? extends NodeBacked>) entityType,
template, getPersistenceUnitUtils(), fieldAccessorFactory,
persistentEntity);
if (!detachable) return partialNodeEntityState;