Skip to content
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

New Feature Added to MyBatis Plugin: Annotation SQL Reload Functionality #558

Merged
merged 7 commits into from
Aug 7, 2024

Conversation

homejim
Copy link
Contributor

@homejim homejim commented Aug 7, 2024

1.Feature Added: Enable SQL reload when using annotation-based SQL.
2.Feature Added: Enable reload when there are changes in entity classes, such as result entity or parameter entity classes.
3.Refactor MyBatisTransformers code to improve readability and maintainability.

hejiajin and others added 7 commits July 31, 2024 23:32
…E) occurs during reload, and also differentiate between MyBatis and MyBatis-Spring modes
Fix the issue where using the insertAt method might fail due to changes in the processPropertyPlaceHolders method body. Add a list variable at the beginning of the method, include the factory in the list after factory initialization, and finally execute the removal logic at the end of the method.

Why not execute the removal right after initialization? I tried that, but it fails during reload.
Update MyBatisTransformers.java
1.Refactor MyBatisTransformers code to improve readability and maintainability.
3.Feature Added: Enable SQL reload when using annotation-based SQL.
2.Feature Added: Enable reload when there are changes in entity classes, such as result entity or parameter entity classes.
@homejim
Copy link
Contributor Author

homejim commented Aug 7, 2024

@skybber
In the previous version of the MyBatis plugin, reload was only triggered when changes were made to XML files. However, MyBatis also supports annotation-based SQL, and in such cases, MyBatis does not update when classes are modified. My commit introduces a reload feature for annotation-based SQL.

I will also submit related unit tests in the future, including tests for previous fixes made to spring-mybatis.

@homejim
Copy link
Contributor Author

homejim commented Aug 7, 2024

After this commit is merged, I will continue to work on the MyBatis-Plus plugin. The related validations have been completed. This will address issues similar to 475.

@skybber
Copy link
Contributor

skybber commented Aug 7, 2024

@homejim great work! Would it be possible to add junit tests for it? You can look at OwbJakartaPluginTest / swapClasses() method how to redefine class in junit test.

@homejim
Copy link
Contributor Author

homejim commented Aug 7, 2024

@homejim great work! Would it be possible to add junit tests for it? You can look at OwbJakartaPluginTest / swapClasses() method how to redefine class in junit test.

Yes, I will add the unit tests for these features in the next few days

@skybber
Copy link
Contributor

skybber commented Aug 7, 2024

Thanks!

@skybber skybber merged commit 53c92ea into HotswapProjects:master Aug 7, 2024
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 this pull request may close these issues.

2 participants