Raw String Literals に対応した場合、SQL取得は内部文字列、外部ファイル、自動生成の3モードとなる。
sql 要素に enum で STRING, FILE, AUTO の3モードいずれかを指定するようにする。デフォルトは、STRING
@Select(sql = STRING, value = `select * from emp`)
Emp select();エイリアスとして
@Select(`select * from emp`)
Emp select();@Select(sql = FILE)
Emp select();@Select(sql = AUTO)
Emp select();@Select(sql = AUTO)
Emp select(Integer id);メソッド引数名は、エンティティのフィールド名に存在するものである必要がある。
生成されるSQLは、
select /*%expand*/* from emp where id = /* id */1これが実装されるとアノテーションの組み合わせによりコンパイルエラーにするパターンがなくなる。
@Insert(sql = STRING, value = `insert into ...`)
int insert(Emp e);エイリアスとして
@Insert(`insert into ...`)
int insert(Emp e);@Insert(sql = FILE)
int insert(Emp e);@Insert(sql = AUTO)
int insert(Emp e);