Skip to content

MappingContext should not consider java.util.Optional an entity type #2390

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

Closed
christophstrobl opened this issue Jun 23, 2021 · 0 comments
Closed
Assignees

Comments

@christophstrobl
Copy link
Member

While this has been fine for quite a while the tightened access restrictions as of Java16 cause trouble when trying to open the protected constructor via reflection.
Further more considering a nullable wrapper type, like Optional, a persistent entity is problematic, cause it is the actual type argument that should be taken into account.

Things to do:

  • Introduce nullable wrapper check to TypeInformation.
  • Return the component type of the wrapper for TypeInformation#getActualType.
  • Use the nullable component type when adding persistent entities for a property.
@christophstrobl christophstrobl self-assigned this Jun 23, 2021
christophstrobl added a commit to spring-projects/spring-data-mongodb that referenced this issue Jun 23, 2021
christophstrobl added a commit to spring-projects/spring-data-mongodb that referenced this issue Jun 25, 2021
@mp911de mp911de added this to the 2.6 M1 (2021.1.0) milestone Jul 8, 2021
@mp911de mp911de closed this as completed in 1f77786 Jul 8, 2021
mp911de pushed a commit that referenced this issue Jul 8, 2021
mp911de added a commit that referenced this issue Jul 8, 2021
Reduce TypeDiscoverer.isNullableWrapper method visibility to private to avoid exposure in preparation for wider value type support.

Original pull request: #2394.
See #2390.
odrotbohm added a commit that referenced this issue Jul 9, 2021
Unified the calculations made for entityTypeInformation and entityTypes in AbstractPersistentProperty. This avoids both calculations getting out of sync. Also we avoid premature calculation abortions if SimpleTypeHolder.isSimpleType(…) returns true for the raw property type. The latter has caused issues for collection properties in Spring Data KeyValue which considers everything in java.util a simple type.

Related ticket: #2390.
mp911de pushed a commit that referenced this issue Feb 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants