Siena: the scalable persistence tier for Java

[复制链接]
查看11 | 回复3 | 2014-2-19 11:55:14 | 显示全部楼层 |阅读模式
Siena is a persitence API for Java inspired on the Google App Engine Python Datastore API. This is an example of usage:

List someEmployees = Employee.all()

.filter("firstName", "Mark")

.order("-lastName")

.fetch(10);复制代码

Siena is a single API with many implementations. You can use siena with relational databases (using JDBC as underlying persistence mechanism), but you can also use it with the Google App Engine's datastore or with Amazon's SimpleDB. There is also an implementation called siena-remote very useful if you want to use the Google App Engine's datastore remotely. Other implementations are work in progress such as: HBase and DBSLayer.
If you want to use Siena in a relational database it will help you to keep your database schema synchronized with your persistent classes. You just need to add some annotations such as @Table, @Column, etc.
回复

使用道具 举报

千问 | 2014-2-19 11:55:14 | 显示全部楼层
Siena also comes with built-in support for JSON so you can easily store complex data structures in one field in the database. Example:


Employee e = new Employee();

e.firstName = "John";

e.lastName = "Smith";

e.contactInfo = map()

.put("email", "john.[email protected]")

.put("telephone", list("xxx", "yyy"));

e.insert();复制代码
回复

使用道具 举报

千问 | 2014-2-19 11:55:14 | 显示全部楼层
The "contactInfo" field has been defined as a field of type siena.Json. This is how that field is formated into the database:
{"email": "john.[email protected]", "telephone": ["xxx", "yyy"]}复制代码

The parsing and formatting of the Json fields is done in a transparent way. You don't need to worry about that


If you are interested on using Siena in your project take a look at the Getting started guide.
Siena has a small footprint (a few Kbytes) and has very few dependencies:
* Siena for relational databases depends only on JDBC and your JDBC driver. If you want to synchronize the database schema you need also Apache DdlUtils.
* Siena for Google App Engine just depends on GAE.
* Siena for Amazon's SimpleDB has no dependencies.
* Siena-remote just depends on dom4j
* Siena for HBase just depends on HBase.
We are planning to release a 1.0 version this year, but we want people to use it and give us feedback.
回复

使用道具 举报

千问 | 2014-2-19 11:55:14 | 显示全部楼层
nice job
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行