-
Notifications
You must be signed in to change notification settings - Fork 617
Add association support for DTO projections #2305
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. It was not really forgotten but more something that we just had not on our list at all (now it is). |
TBH I cannot reproduce the particular issue, you are facing...but If you could clarify how my example differs from yours, this would be really helpful to give you more input on your problem. Your question also helped us to uncover another missing behaviour around the DTO projections, thanks. |
The links you provided don't seem to work for me. However, I looked at the code on your branch and I think that the difference with my example is that the Also, I really don't see why passing the relation would be necessary here? My projection object does not specify any relation in it. I want to project a person with a possibly null department. What if there was more than one relation to get from ========
I don't know if it's an official feature, but encapsulation does work (except with my use-case of a null one to one projection). I find it much more convenient to use encapsulation than copying 15 fields of Person, don't you think? |
(Updated the links above, somehow the GitHub magic creates something "interesting" out of this link format) If you really, really want to have this objects, you would have to use the |
I see. In your example, I think the difference is that i'm projecting an entity. with another entity, while you seem to project an entity with a property. Also, it's important to know that the entity returned is null and that I do not have an association between @Node("Person")
data class PersonEntity(
@Id
val id: String,
val email: String,
val fullName: String,
)
@Node("Department")
data class DepartmentEntity(
@Id
val id: String,
val name: String
) In my graph, I have a relation between those two entities that is not defined in my domain entity.
Anyway, it seems i'll be using the |
I will close this issue now but give you a small preview of the future: There will probably nested projections coming up. So you can describe your graph model "completely" in SDN but for load and persist operations use projections as a kind of blueprint for the data that you really want to fetch or persist. This will improve not only the performance of fetching data (by just not fetching unneeded data) but also the way data gets persisted without touching / updating unchanged parts. |
I do get how projection work in spring data, tho I find that occasionally useful, my usage of Neo4j really does not fit the projection's use-case at all. That's easy to see with all the problems I get while using them. On the other hand, If I don't want projection, but I want a |
Given I have an entity that has a single relationship to another entity. If I want to have a projection of that entity with a nullable related entity, the request fails.
I actually saw a related issue that is marked as resolved, but I think the null use-case was forgotten in 6.1.2: #2269
The stacktrace I get is
The source of this is in
DefaultNeo4jEntityConverter
.The text was updated successfully, but these errors were encountered: