{"id":25975,"date":"2010-05-09T12:39:52","date_gmt":"2010-05-09T04:39:52","guid":{"rendered":"http:\/\/www.yankay.com\/?p=25975"},"modified":"2010-05-09T12:39:52","modified_gmt":"2010-05-09T04:39:52","slug":"jsa4j%e5%bf%ab%e9%80%9f%e5%85%a5%e9%97%a8","status":"publish","type":"post","link":"http:\/\/yankay.com\/jsa4j%e5%bf%ab%e9%80%9f%e5%85%a5%e9%97%a8\/","title":{"rendered":"Jsa4j\u5feb\u901f\u5165\u95e8"},"content":{"rendered":"
\u5b89\u88c5Java JDK<\/a> <\/strong><\/p>\n \u5b89\u88c5Eclipse<\/a> <\/strong><\/p>\n \u4e0b\u8f7djsa4j-derby<\/a> <\/strong><\/p>\n \u8be6\u7ec6\u53c2\u8003API\u6587\u6863<\/a> <\/strong><\/p>\n\u4f7f\u7528 Jsa4j\u5f00\u53d1<\/a><\/h3>\n
\n
\n
\n package org.jerrymouse.jsa4j.db.kv.example;\n\n import org.jerrymouse.jsa4j.db.kv.DB;\n import org.jerrymouse.jsa4j.db.kv.DBManagerFactory;\n import org.jerrymouse.jsa4j.db.kv.Repository;\n\n public class Tutorial {\n\n private static DB db;\n\n private static String EXAMPLE = \"example\";\n\n private static DB getDB() {\n if (db == null)\n db = new DBManagerFactory().getDBManager(\"derby-db\").getDB();\n return db;\n }\n\n public static Repository getRepository(String prefix) {\n Repository repository = new Repository(prefix, getDB());\n return repository;\n }\n\n public static void main(String[] args) {\n \/\/\u5b58\u653e\u4e00\u4e2a\u5b57\u7b26\u4e32\"hello jsa4j\"\n getRepository(EXAMPLE).put(\"1\", \"hello jsa4j\");\n \/\/\u53d6\u51fa\u8fd9\u4e2a\u5b57\u7b26\u4e32\n String message = getRepository(EXAMPLE).get(\"1\");\n System.out.println(message);\n }\n }\n\n\n<\/pre>\n<\/ul>\n
\n