Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Bring the old JSR-310 type handlers back as 'legacy' #1752

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

Open
harawata wants to merge 1 commit into mybatis:master
base: master
Choose a base branch
Loading
from harawata:resurrect-legacy-jsr310-typehandlers

Conversation

@harawata
Copy link
Member

@harawata harawata commented Nov 25, 2019

The attached tests show the shortcomings of legacy type handlers.

These legacy type handlers seem to be useful to some users.
Any objections?

silvertype and zhoujin7 reacted with thumbs up emoji
The attached tests show the shortcomings of legacy type handlers.
Copy link

@silvertype silvertype left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really needed.

Copy link
Member

@harawata Do you still want to bring this in? Seems like its an ok idea.

Copy link
Member Author

@hazendaz ,

It wouldn't hurt, I guess :)
I'll update the comments/headers.

Copy link

@hazendaz @harawata How about including this in version 3.6.X

Copy link
Member Author

harawata commented Jan 4, 2025

@GeorgeSalu ,

Um...the idea looks even less attractive in 2025... 😓
Given that it is pretty easy for users to copy these legacy type handlers, I think we should just close this PR.

Copy link

I agree that they are simple and that is why I think it would be a good idea to have these "basic" handlers, just as I have copies in several projects, for example, of a handler that converts tinyint to boolean for MySQL. It would be good if we already had these "basic" handlers at least.

Copy link
Member Author

harawata commented Jan 5, 2025

@hazendaz @epochcoder

If either of you are OK with this, feel free to merge.
I want to keep my hands clean. 👋 ✨😆

Copy link
Member

hazendaz commented Jan 6, 2025

@harawata What if we split out type handlers completely and then allow that to be a slush fund of handlers? Really anything in core that starts to feel lite its more than just core intent should be extracted out for more modular design. Not sure that would entirely help but I know I could offload a couple type handlers I support at work since core doesn't support them. I'm sure others based on comments are in the same boat. I know we had a type handler library before but it was isolated to one type so maybe a catch all. Even if we don't actually release that, it would at least have a place we store for all to use and others could add to it. With some tricks folks could pull the source and build their jars with bits and pieces of that without having to repeat it. Easier to find source at very least to get folks started.

Copy link
Member Author

harawata commented Jan 6, 2025
edited
Loading

@hazendaz ,

I'm sorry, I'm very bad at understanding new ideas 😓
Let me clarify step by step.

What does "split out type handlers completely" actually mean?
Does it mean we move the interface org.apache.ibatis.type.TypeHandler (and its implementations) out of this repository and create a new module (e.g. mybatis-type-handlers) ?
Then, add the new 'type handler module' to the core's dependency?

Copy link
Member

@hazendaz ,

I'm sorry, I'm very bad at understanding new ideas 😓 Let me clarify step by step.

What does "split out type handlers completely" actually mean? Does it mean we move the interface org.apache.ibatis.type.TypeHandler (and its implementations) out of this repository and create a new module (e.g. mybatis-type-handlers) ? Then, add the new 'type handler module' to the core's dependency?

That was my thinking then, yes. Basically anytime something starts to become its own thing, I think it needs to be a separate module but we don't have to do that unless we really feel its needed.

Copy link
Member Author

harawata commented Feb 12, 2025
edited
Loading

Thank you for the reply, @hazendaz !

Then let's assume we did that (i.e. created a new module 'mybatis-type-handlers').
And you wrote that you can "offload a couple type handleres I support at work since core doesn't support them".
It means (I assume) that we should maintain those in-house type handlers created by you or other developers under the new mybatis-type-handlers repo, but I don't understand how it improves the situation for anybody.

Here is what people are currently doing (or should be doing) if they maintain in-house type handlers.
They 1) create their own module e.g. 'mycompany-typehandlers', 2) put their custom type handlers in that module and 3) use it in their projects (it can be published to private repository or maven central if it makes things easier).
In each project, the developer needs to 1) add the module to the dependency list and 2) specify type-handnler-package in the config.

Now, even with the new 'mybatis-type-handlers' module, people have to follow the same step, basically i.e. 1) add 'mybatis-type-handlers' to the dependencies and 2) specify 'type-handler-package' in the config.
But, it could get worse, actually, because it is reasonable to assume that there will be multiple different type handler implementations for the same type (e.g. UUID [1]).
And if that happens, people will no longer be able to rely on the handy 'type-handler-package' and may have to specify each type handler explicitly.

I probably am misunderstanding something, but am not sure what.

[1] Different DB/driver requires different type handler implementation for UUID. c.f. #3286 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

1 more reviewer

@silvertype silvertype silvertype approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /