-
Notifications
You must be signed in to change notification settings - Fork 617
Generated objects onSave are not considered as already processed. #2223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks for reporting this.
to your repositories and
|
I can feed this snapshot into a more challenging graph this evening and will let you know tonight whether that works. |
Thanks you very much for the fast feedback. |
Okay, I gave this a slightly more extreme test and (a) the saves did not throw an exception and (b) the resulting node displays looked fine in the neo4j desktop application. |
(yet another) great feedback, thanks. |
I noticed that we had the id hydration or, to be correct, the possible re-creation of objects and collections already in 6.1 completed. For me this issue was now a good reason to port it back into the 6.0 line. |
Sure, did you mean the latest snapshot of 6.0.9-GH-2223 |
Exactly. Still nothing I would rate as production ready yet but at least should give the desired ids back. |
Well on the positive front, I can see the ids, so that is good. |
Okay, I think it may be struggling with empty lists. @Node(node_larder)
data class Larder constructor(
@Id @GeneratedValue override val id: Long? = null,
val localDate: LocalDate,
@Relationship(type = rel_larder_to_serving) var servingList: List<Serving>,
override val timestamp: Instant = Instant.now(),
override val userId: String
) : UserEntityAbst<Larder> I am genuinely not sure why I have set the servingList as a var here, as opposed to a val.
against the servingList, when the code attempts to instantiate the Larder. Apologies, as I do not have the time today for a more detailed, or for that matter confident, analysis. |
Thanks. I will probably also look at this Monday again, so no hurry and thanks for the feedback. |
onSave immutable entities will get re-created if they have generated ids. In those cases if a node gets referenced more than once (e.g. A->B->C and A->C) the resulting entities will not be considered as the same because one has already an identifier set, the other not yet. In thoses cases the logic either persisted a duplicate or it could not find the already processed entity because the identifier of the entity in question is still `null`. Closes #2223
onSave immutable entities will get re-created if they have generated ids. In those cases if a node gets referenced more than once (e.g. A->B->C and A->C) the resulting entities will not be considered as the same because one has already an identifier set, the other not yet. In thoses cases the logic either persisted a duplicate or it could not find the already processed entity because the identifier of the entity in question is still `null`. Closes #2223
onSave immutable entities will get re-created if they have generated ids. In those cases if a node gets referenced more than once (e.g. A->B->C and A->C) the resulting entities will not be considered as the same because one has already an identifier set, the other not yet. In thoses cases the logic either persisted a duplicate or it could not find the already processed entity because the identifier of the entity in question is still `null`. Closes #2223
So looking for a little clarification here on a possible issue.
As first referenced by https://community.neo4j.com/t/kotlin-neo4j-graph-saving/36378/1
Kotlin 1.4.31
Spring Framework Boot 2.4.4
Desktop 4.2.4
also see GitHub - https://github.com/Wayne-P/graph/tree/master
So we have three classes imaginatively labelled A, B & C
So, roughly,
A has a B and a C.
B has a list of C .
So far, so good.
The application code ...
Now curiously, repeated efforts to execute this code give different results.
Sometimes, an IllegalStateExcexception from the save attempt of
Other times, the code runs without exception to produce two c1 s with different ids.
I would have expected to see a graph with just one c1 ,as opposed to a tree.
I appreciate that work has been done in
https://github.com/spring-projects/spring-data-neo4j/issues/2148
to ensure that ids of subcomponents are correctly returned in response to a save, but will this work lead to one c1 being created here ?
Many thanks for considering this.
The text was updated successfully, but these errors were encountered: