-
Notifications
You must be signed in to change notification settings - Fork 38
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
Cyclic mapping defense #2
Comments
I had solved this in a former homegrown solution. The rationale for the target class was that the same "source" could be mapped twice in the DTO tree. The reason for not using an IdentityHashMap was that our underlying lib above JPA would possibly generate several instances for the same row in the database... The cache only lived inside a top level conversion from the user... (it was cleared as soon as the conversion returned to the user). In other words, if I had a Person with an Address (both translating to PersonDto and AddressDto) the cached would last from the Person to PersonDto conversion (including the nested Address to AddressDto). However, if the user explicitly asked to translate an Address to an AddressDto (not as part of a Person), then the cache would last just there... This allowed to convert complex structures such as graphs. |
Selma should either forbid cyclic mapping by failing at compile time or
have a smarter way.
Selma should never go in eternal mapping loop in such condition.
Bean A contains a bean B which contains original A.
The text was updated successfully, but these errors were encountered: