-
Notifications
You must be signed in to change notification settings - Fork 377
DATAJDBC-252 - Properties only get set if they are not part of the constructor. #86
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
Conversation
…nstructor. For mutable entities this avoids superfluous setting of attributes. For imutables without "Wither"s this avoids failures due to not being able to set a property.
|
|
||
| Object id = idProperty == null ? null : readFrom(resultSet, idProperty, ""); | ||
|
|
||
| PreferredConstructor<T, RelationalPersistentProperty> persistenceConstructor = entity.getPersistenceConstructor(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should avoid the iteration over the properties entirely by returning the just created instance if PersistentEntity.requiresPropertyPopulation() is false.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
… all. This avoids needless iterating over the properties for instances fully constructed by their constructor.
…ete constructors correctly.
…ted. The entity creation not skips the property population entirely if the metamodel indicates that the instantiation already creates a complete entity. If there's need to actively populate properties, we now correctly skip the ones already consumed by the constructor. Original pull request: #86.
Convert idents to tabs. Fix Kotlin extensions formatting. Original pull request: #86.
Remove unused imports. Original pull request: #86.
For mutable entities this avoids superfluous setting of attributes.
For imutables without "Wither"s this avoids failures due to not being able to set a property.