Repository navigation
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I think,
getNamewould be more correct here.toStringusually tells more about object.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.
@jjtt would you please add
getNamemethod also?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.
The problem in the case mentioned in the PR description is that something ends up calling
toString()to convert theEnum8/Enum16in the db into a string returned by a query. So that something doesn't know that it should callgetName().I don't know which part decides that the column type is a String in Java. Maybe that should be changed to default to using an integer type for enums and then it wouldn't matter what the
toString()of anEnumValueis?In my use case I don't care about the integer value of the enum, but I'm sure I could change the query to explicitly return a string. This
SELECT *is actually in integration test code that verifies the db content. IMO, production code shouldn't useSELECT *anyway.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.
I guess this also needs to be considered:
so there are situations where the string value of the enum can be unknown to the driver?
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.
In some cases with Dynamic types it can be unknown. Theoretically.
As for the rest - It should be fixed may be in another place to make it aware about
getName. We will look at it later.