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

Add SQL provider class that help detecting a template file automatically #10

Closed
kazuki43zoo opened this issue Mar 7, 2019 · 0 comments · Fixed by #19
Closed

Add SQL provider class that help detecting a template file automatically #10

kazuki43zoo opened this issue Mar 7, 2019 · 0 comments · Fixed by #19
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@kazuki43zoo
Copy link
Member

kazuki43zoo commented Mar 7, 2019

for example:

package com.example.demo.mapper;

interface DemoMapper {
  @InsertProvider(type = TemplateFilePathProvider.class)
  void insert(Demo demo);
}

By default, you can load a template file (e.g. com/example/demo/mapper/DemoMapper/DemoMapper-insert.sql) automatically.

project-root
  + src
    + main
       + resources (just under class-path )
          + com
             + example
                + demo
                   + mapper
                      + DemoMapper 
                         - DemoMapper-insert.sql

This feature depends on mybatis/mybatis-3#1391 and mybatis/mybatis-3#1503. In other words, this feature required to use on MyBatis 3.5.1+.

Also you can customize path format using static setter methods of TemplateFilePathProvider.

  • Can excludes mapper name in template file (e.g. com/example/demo/mapper/DemoMapper/insert.sql)
project-root
  + src
    + main
       + resources (just under class-path )
          + com
             + example
                + demo
                   + mapper
                      + DemoMapper 
                         - insert.sql
  • Can exclude directory per mapper (e.g. com/example/demo/mapper/DemoMapper-insert.sql)
project-root
  + src
    + main
       + resources (just under class-path )
          + com
             + example
                + demo
                   + mapper
                      - DemoMapper-insert.sql
  • Can excludes a package path (e.g. DemoMapper/DemoMapper-insert.sql)
project-root
  + src
    + main
       + resources (just under class-path )
           + DemoMapper 
               - DemoMapper-insert.sql
  • Can adding a path prefix (e.g. sqls/)
project-root
  + src
    + main
       + resources (just under class-path )
          + sqls
             + com
                + example
                   + demo
                      + mapper
                         + DemoMapper 
                             - DemoMapper-insert.sql

Document

Related links

@kazuki43zoo kazuki43zoo added this to the 1.0.0 milestone Mar 7, 2019
@kazuki43zoo kazuki43zoo added the enhancement New feature or request label Mar 7, 2019
@kazuki43zoo kazuki43zoo modified the milestones: 1.0.0, General Backlog Mar 9, 2019
@kazuki43zoo kazuki43zoo changed the title Add feature for loading a template file automatically if SQL not present on annotation or xml Add feature for loading a template file automatically Mar 17, 2019
@kazuki43zoo kazuki43zoo modified the milestones: General Backlog, 1.0.1 Apr 13, 2019
@kazuki43zoo kazuki43zoo changed the title Add feature for loading a template file automatically Add SQL provider class that help detecting a template file automatically Apr 13, 2019
@kazuki43zoo kazuki43zoo self-assigned this Apr 13, 2019
kazuki43zoo added a commit to kazuki43zoo/thymeleaf-scripting that referenced this issue Apr 13, 2019
kazuki43zoo added a commit to kazuki43zoo/thymeleaf-scripting that referenced this issue Apr 14, 2019
kazuki43zoo added a commit to kazuki43zoo/thymeleaf-scripting that referenced this issue Apr 14, 2019
kazuki43zoo added a commit that referenced this issue Apr 14, 2019
Add SQL provider class that help detecting a template file automatically
kazuki43zoo added a commit to kazuki43zoo/thymeleaf-scripting that referenced this issue Apr 14, 2019
kazuki43zoo added a commit to kazuki43zoo/thymeleaf-scripting that referenced this issue Apr 14, 2019
kazuki43zoo added a commit that referenced this issue Apr 14, 2019
Refactoring configuration for TemplateFilePathProvider
kazuki43zoo added a commit to kazuki43zoo/thymeleaf-scripting that referenced this issue Apr 15, 2019
kazuki43zoo added a commit that referenced this issue Apr 15, 2019
Support cache feature on TemplateFilePathProvider
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
1 participant