资 源 简 介
Welcome
ClioneSQL is a library for generating SQL easily and safety.
First Sample
If you use ClioneSQL, you can write find method as follows.
-method
import static tetz42.clione.SQLManager.*;
:
public List findAllByAgeAndPref(Integer age, String pref) throws SQLException {
return sqlManager().useFile(getClass(), "Select.sql")
.findAll(
Entity.class,
params("age", age).$("pref", pref)
);
}
-"Select.sql"
SELECT
*
FROM
people
WHERE
age = /* $age */25
AND prefecture = /* $pref */"Tokyo"
The parameters of "Select.sql" is specified as SQL comment. So it can be performed by general SQL client tools.
ClioneSQL replaces /* $age */ and /* $pref */ to place holders as follows:
SEL