HSQLDBでActiveJDBCを使用しようとしています:
Base.open("org.hsqldb.jdbc.JDBCDriver", "jdbc:hsqldb:file:queen-db;shutdown=true;hsqldb.write_delay=false;", "sa", "");
User e = new User();
e.set("id", 1);
e.set("nickname", "Superman");
e.set("first_name", "John");
e.set("last_name", "Doe");
e.saveIt();
User e1 = new User();
e1.set("id", 2);
e1.set("nickname", "Superman2");
e1.set("first_name", "John2");
e1.set("last_name", "Doe2");
e1.saveIt();
List<User> users = User.findAll();
for (User user : users) {
System.out.println(user.get("id") + " " + user.get("nickname") + " " + user.get("first_name") + " " + user.get("last_name"));
}
出力がなく、DBに情報がありません。FlyWay の移行は次のとおりです。
CREATE TABLE users (
id INT NOT NULL,
nickname VARCHAR(100) NOT NULL,
first_name VARCHAR(100) NOT NULL,
last_name VARCHAR(100) NOT NULL
);
どうしたの?
追加: Log4J をセットアップし、メッセージを取得しました:
0 [main] INFO hsqldb.db.HSQLDB3F3E800675.ENGINE - checkpointClose start
35 [main] INFO hsqldb.db.HSQLDB3F3E800675.ENGINE - checkpointClose end
更新: ここにログ出力があります
0 [main] INFO hsqldb.db.HSQLDB3F42F00869.ENGINE - checkpointClose start
37 [main] INFO hsqldb.db.HSQLDB3F42F00869.ENGINE - checkpointClose end
68 [main] INFO org.javalite.activejdbc.ConnectionsAccess - Attaching connection: org.hsqldb.jdbc.JDBCConnection@41a78257
68 [main] INFO org.javalite.activejdbc.ConnectionsAccess - Opened connection:org.hsqldb.jdbc.JDBCConnection@41a78257 named: default on thread: Thread[main,5,main]
97 [main] INFO org.javalite.activejdbc.Configuration - Load models from: jar:file:/Users/dmitrysavchenko/projects/hive-queen/target/queen-jar-with-dependencies.jar!/activejdbc_models.properties
116 [main] INFO org.javalite.activejdbc.Registry - Registered model: class org.hive.models.User
285 [main] INFO org.javalite.activejdbc.Registry - Fetched metadata for table: users
302 [main] INFO org.javalite.activejdbc.DB - Query: "UPDATE users SET first_name= ?, nickname= ?, last_name= ? where id = ?", with parameters: <John>, <Superman>, <Doe>, <1>, took: 11 milliseconds
305 [main] INFO org.javalite.activejdbc.DB - Query: "UPDATE users SET first_name= ?, nickname= ?, last_name= ? where id = ?", with parameters: <John2>, <Superman2>, <Doe2>, <2>, took: 0 milliseconds
315 [main] INFO org.javalite.activejdbc.LazyList - Query: "SELECT * FROM users", took: 4 milliseconds
間違った操作が行われたようです。どうしたの?