Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
10-29-2019 11:58 PM
Can we be sure that if we load the same entity (or relationship) in multiple threads, the loaded objects are not the same? (They represent the same entity or relation, but I'm asking about the same java objects).
11-04-2019 04:10 AM
If you open a fresh Session
for every thread and load the same nodes from the graph, the Java objects are independent. But be aware that OGM does its mapping based on the identifiers. So two different Java objects with the same id value will always be seen as the same when it comes to the persistence of those. To avoid conflicts it might be a good advice to look in the optimistic locking section of the documentation.
11-05-2019 12:18 AM
Thanks.
11-06-2019 06:28 AM
Session
is bound to a @Transactional
transaction and will throw an exception if accessed from multiple threads.Session
. You will have duplicated objects in different session caches but accessing them will never return an object from another session but its very own.11-20-2019 02:19 AM
@gerrit.meier You said: " The caches belong to each Session
." Is the cache you mentioned the same as the page cache? If they are the same, doesn't your sentence mean that, e.g., if many threads try to read the the same node, no cache is used because the threads use different sessions?
All the sessions of the conference are now available online