微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

KeyAccess ORM框架

程序名称:KeyAccess

授权协议: MIT

操作系统: 跨平台

开发语言: Java

KeyAccess 介绍

KeyAccess 是一个轻量级的对象关系映射框架(ORM),利用现有数据库生成对象模型。

示例代码

// All artists
List artists = Artist.queryObjects(conn);

// Artists with a good rating
List newArtists = Artist.queryObjects(conn, “rating > 4”);

// Get the number of classical albums
int numClassicalAlbums = Album.queryCount(conn, “type = ‘CLASSICAL’ “);

// Load single object by one or more primary keys (vararg)
Artist artist = Artist.queryObjectByKey(conn, 294);

// Load all objects, but not into a list: call a callback function for each
object instead.
// This can dramatically reduce memory requirements if you need to process
// thousands of objects. There is also a version available where you can
// supply a where clause.
Artist.queryObjects(conn, new IObjectLoadHandler()
{
public void onLoad(Object obj)
{
System.out.println(“Artist: “+ ((Artist)obj).getName());
}
});

KeyAccess 官网

http://code.google.com/p/keyaccess/

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐