-
Notifications
You must be signed in to change notification settings - Fork 0
Support for Using @DataType-Annotated Records in DAO Method Return and Parameter Types
#350
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
Merged
Merged
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
...tData/src/main/java/doma/example/dao/inspection/returntype/DataTypeReturnTypeTestDao.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| package doma.example.dao.inspection.returntype; | ||
|
|
||
| import org.seasar.doma.*; | ||
| import doma.example.domain.Salary; | ||
| import org.seasar.doma.jdbc.Reference; | ||
| import org.seasar.doma.jdbc.Result; | ||
|
|
||
| import java.util.List; | ||
| import java.util.Optional; | ||
|
|
||
| @Dao | ||
| public interface DataTypeReturnTypeTestDao { | ||
|
|
||
| @Select | ||
| @Sql("select * from salary where id = /*salary.value*/0") | ||
| Salary selectSalary(Salary salary); | ||
|
|
||
| @Select | ||
| @Sql("select * from salary where id = /*salary.value*/0") | ||
| Optional<Salary> selectOptSalary(Salary salary) ; | ||
|
|
||
| @Update | ||
| @Sql("UPDATE salary SET val = /*salary.value*/0") | ||
| int updateSalaryWithSql1(Salary salary); | ||
|
|
||
| @Update | ||
| @Sql("UPDATE salary SET val = /*salary.value*/0") | ||
| Result<Salary> <error descr="The return type must be \"int\"">updateSalaryWithSql2</error>(Salary salary); | ||
|
|
||
| @Insert | ||
| @Sql("INSERT INTO salary (val) VALUES (/*salary.value*/0)") | ||
| int insertSalaryWithSql(Salary salary); | ||
|
|
||
| @Insert | ||
| @Sql("INSERT INTO salary (val) VALUES (/*salary.value*/0)") | ||
| Result<Salary> <error descr="The return type must be \"int\"">insertSalaryWithSql2</error>(Salary salary); | ||
|
|
||
| @Delete | ||
| @Sql("DELETE FROM salary WHERE val = /*salary.value*/0 ") | ||
| int deleteSalaryWithSql(Salary salary); | ||
|
|
||
| @Delete | ||
| @Sql("DELETE FROM salary WHERE val = /*salary.value*/0 ") | ||
| Result<Salary> <error descr="The return type must be \"int\"">deleteSalaryWithSql2</error>(Salary salary); | ||
|
|
||
| @BatchUpdate | ||
| @Sql("UPDATE salary SET val = /*salary.value*/0") | ||
| int[] batchUpdateSalaryWithSql(List<Salary> salary); | ||
|
|
||
| @BatchUpdate | ||
| @Sql("UPDATE salary SET val = /*salary.value*/0") | ||
| <error descr="Cannot resolve symbol 'BatchResult'">BatchResult</error><Salary> <error descr="The return type must be \"int[]\"">batchUpdateSalaryWithSql2</error>(List<Salary> salary); | ||
|
|
||
| @BatchInsert | ||
| @Sql("INSERT INTO salary (val) VALUES (/*salary.value*/0)") | ||
| int[] batchInsertSalaryWithSql(List<Salary> salary); | ||
|
|
||
| @BatchInsert | ||
| @Sql("INSERT INTO salary (val) VALUES (/*salary.value*/0)") | ||
| <error descr="Cannot resolve symbol 'BatchResult'">BatchResult</error><Salary> <error descr="The return type must be \"int[]\"">batchInsertSalaryWithSql2</error>(List<Salary> salary); | ||
|
|
||
| @BatchDelete | ||
| @Sql("DELETE FROM salary WHERE val = /*salary.value*/0 ") | ||
| int[] batchDeleteSalaryWithSql(List<Salary> salary); | ||
|
|
||
| @BatchDelete | ||
| @Sql("DELETE FROM salary WHERE val = /*salary.value*/0 ") | ||
| <error descr="Cannot resolve symbol 'BatchResult'">BatchResult</error><Salary> <error descr="The return type must be \"int[]\"">batchDeleteSalaryWithSql2</error>(List<Salary> salary); | ||
|
|
||
| @Function | ||
| List<Salary> getTopSalaries(@In Salary limit); | ||
|
|
||
| @Function | ||
| Optional<Salary> getMaxSalary(@InOut Reference<Salary> percentage, @ResultSet List<Salary> resultSet); | ||
|
|
||
| @Procedure | ||
| void computeBonus(@In Salary employeeId); | ||
|
|
||
| @Procedure | ||
| void adjustSalaries(@InOut Reference<Salary> percentage, @ResultSet List<Salary> resultSet); | ||
|
|
||
| } |
8 changes: 8 additions & 0 deletions
8
src/test/testData/src/main/java/doma/example/domain/Salary.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| package doma.example.domain; | ||
|
|
||
| import java.math.BigDecimal; | ||
| import org.seasar.doma.DataType; | ||
|
|
||
| @DataType | ||
| public record Salary(BigDecimal value) { | ||
| } |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.