Java实现的开源RDBMS+NoSQL数据库:OhmDB
jopen
10年前
让Java开发者在一个JAR中,就能够用到RDBMS和NoSQL两者的优点。
import com.ohmdb.api.*; class Person { public String name; public int age; } public class Main { public static void main(String[] args) { Db db = Ohm.db("ohm.db"); Table<Person> persons = db.table(Person.class); Person $p = persons.queryHelper(); Person p1 = new Person(); p1.name = "Niko"; p1.age = 30; long id = persons.insert(p1); Person p2 = persons.get(id); persons.createIndexOn($p.age); Person[] adults = persons.where($p.age).gte(18).get(); db.shutdown(); } }