private Neo4JMappingContext mappingContext;
public EntityState<NodeBacked,Node> getEntityState(final NodeBacked entity) {
final Class<? extends NodeBacked> entityType = entity.getClass();
final NodeEntity graphEntityAnnotation = entityType.getAnnotation(NodeEntity.class); // todo cache ??
final Neo4JPersistentEntity<?> persistentEntity = mappingContext.getPersistentEntity(entityType);
if (graphEntityAnnotation.partial()) {
final PartialNodeEntityState<NodeBacked> partialNodeEntityState = new PartialNodeEntityState<NodeBacked>(null, entity, entityType, graphDatabaseContext, getPersistenceUnitUtils(), delegatingFieldAccessorFactory, (Neo4JPersistentEntity<NodeBacked>) persistentEntity);
return new DetachedEntityState<NodeBacked, Node>(partialNodeEntityState, graphDatabaseContext) {
@Override
protected boolean isDetached() {
return super.isDetached() || partialNodeEntityState.getId(entity) == null;