Reputation: 3408
I use GraphAware Neo4j UUID plugin. If I create entity using this:
Entity createdEntity = repository.save(entity);
then createdEntity.uuid
property will always be null
; but I see the uuid
property is set in the db.
Moreover, if I will use the following to reload the entity:
Entity foundEntity = repository.findOne(id);
the property will be null
again.
Seems like the entity is cached by Spring, because if I will restart my Spring application, I will be able to load entity along with uuid
using repository.findOne(id)
.
I need to know uuid
right after creation of entity. How can I achieve this?
Upvotes: 1
Views: 372
Reputation: 19373
The entity properties are cached in the current session (believe you're using SDN 4.2.x?), so you need to reload on a new session. This is especially true for modifications made in event handlers where changes made in them are not reflected till a separate call is performed.
See http://docs.spring.io/spring-data/neo4j/docs/4.2.x/reference/html/#_design_consideration_session_caching for more info
Upvotes: 3