pBeans 2.0发布. 使用annotations

liusf 发表于 2007-03-28 08:21:30 作者:Liusf     来源:pBeans
评论数:4     点击数:790

摘要:

pBeans 2.0版本发布了.pBeans是一个以简单为目标的O/R Mapping工具。新版本主要是改进使用了annotations.
pBeans 2.0版本发布了.

pBeans是一个以简单为目标的O/R Mapping工具。它根据Java Bean规则自动决定映射到数据库的字段,它on demand创建表结构,它根据最常见的情况判定对象关联,它甚至根本就没考虑事务的问题。但是,使用pBeans够简单,所以它未尝不可以成为单用户桌面应用程序的一种持久化选择。

用Groovy和pBeans结合的一段对象持久化代码如下(来自http://weblogs.java.net/pub/wlg/1299):


import net.sourceforge.pbeans.data.*
import net.sourceforge.pbeans.*

dataSource = new GenericDataSource()
dataSource.setDriverClassName("com.mysql.jdbc.Driver")
dataSource.setUrl("jdbc:mysql://localhost/test?user=test&password=test")

store = new Store(dataSource)

class User implements Persistent {
    Integer id
    String name
    Integer age
    String hometown
}

joe = new User(name:"Joe User", age:43, hometown:"Bay Minette, AL")
store.insert(joe)
newjoe = store.selectSingle(User.class, "name", "Joe User")
assert newjoe.hometown == "Bay Minette, AL"


新版本主要是改进使用了annotations.

官方站点:
http://pbeans.sourceforge.net/

本页页面地址:

用户评论列表

#1 评论作者: phoenixup 发表时间: 2007-03-28 03:09 下午

Hibernate,IBatis,Toplink我觉得自己对ORM有点疲劳了。。。。

#2 评论作者: mreay 发表时间: 2007-03-28 04:02 下午

用Hibernate就好了!

#3 评论作者: kjj 发表时间: 2007-03-28 08:17 下午

光hibernate就让我搞了好久啊,现在才觉得刚刚入门啊

#4 评论作者: HotTea 发表时间: 2007-04-05 04:02 下午

有竞争才有进步,这些积累是JAVA逐步走向成熟的必由之路.


发表我的评论 (评论可增加个人积分...)

用户*: E-mail:
评论内容*:

支持BBCode
算术题*: + =