diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2017-03-23 17:10:39 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2017-03-23 17:10:39 +0100 |
commit | 724efad67fe61d2c02c41af24ebc352eb79ff2f8 (patch) | |
tree | 777e62835ca2f6901d8d2542e328fcea403f9680 /java/MyMyBatis/src/Main.java | |
parent | bb1caf716a18b65fa42d7bed2369b66a0837d977 (diff) | |
download | share-724efad67fe61d2c02c41af24ebc352eb79ff2f8.zip share-724efad67fe61d2c02c41af24ebc352eb79ff2f8.tar.gz |
java : add MyMyBatis
Diffstat (limited to 'java/MyMyBatis/src/Main.java')
-rw-r--r-- | java/MyMyBatis/src/Main.java | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/java/MyMyBatis/src/Main.java b/java/MyMyBatis/src/Main.java new file mode 100644 index 0000000..9e69b0d --- /dev/null +++ b/java/MyMyBatis/src/Main.java @@ -0,0 +1,41 @@ +package ch.asynk; + +import java.util.List; + +public class Main +{ + public static void main(String [] args ) + { + try { + ModelDAO.getSqlConnection().runScript("create.sql"); + } catch (java.io.IOException e) { + System.err.println(e.getMessage()); + } + + ModelDAO dao = ModelDAO.getInstance(); + Model m; + List<Model> models; + + System.out.println("count : " + dao.count()); + models = dao.select(); + System.out.println("select : "); + for (Model _m : models) System.out.println(" - " +_m.toString()); + + m = dao.selectOne(2); + System.out.println("selectOne : " + m.toString()); + System.out.println("update ..."); + m.setName("adios"); + dao.update(m); + m = dao.selectOne(2); + System.out.println("selectOne : " + m.toString()); + System.out.println("delete : " + dao.delete(m)); + System.out.println("count : " + dao.count()); + System.out.println("insert ..."); + m = new Model(-1, "HoMySatan"); + dao.insert(m); + System.out.println("count : " + dao.count()); + System.out.println("select : "); + models = dao.select(); + for (Model _m : models) System.out.println(" - " +_m.toString()); + } +} |