Java对象的SQL接口 JoSQL

fmms 13年前

Java对象的SQL接口 JoSQL

JoSQL(SQLforJavaObjects)为Java开发者提供运用SQL语句来操作Java对象集的能力.利用JoSQL可以像操作数据库中的数据一样对任何Java对象集进行查询,排序,分组。

示例用法

// Get a list of java.io.File objects.  List myObjs = getMyObjects ();    // Create a new Query.  Query q = new Query ();    // Parse the SQL you are going to use.  q.parse ("SELECT * FROM java.io.File WHERE name LIKE '%.java'");    // Execute the query.  QueryResults qr = q.execute (myObjs);    // Cycle over the query results.  List res = qr.getResults ();    for (int i = 0; i < res.size (); i++)  {        File f = (File) res.get (i);        // Do something with the File.    }

项目主页:http://www.open-open.com/lib/view/home/1334820969702