Easy Java Persistence - 对象持久化框架

jopen 11年前

EJP是一个强大并且易于使用的关系数据库持久化Java API。EJP的主要特性包括:

  1、对象/关系(object/relational)自动映射(A-O/RM) 
  2、自动处理所有关联 
  3、自动持久化跟踪 

EJP不需要映射注释或XML配置,并且不需要继承任何类或实现任何接口。EJP只用到了Plain Old Java Objects (POJOs)对象。到目前为止,EJP是Java开源中最简单的持久化API。

示例代码:

    public static void main(String[] args)        {          // One of many ways to connect to your database          DatabaseManager dbm = DatabaseManager.getDatabaseManager("com.mysql.jdbc.Driver",                                                                    "jdbc:mysql://localhost/ejp_example");                 dbm.saveObject(new Customer("Smith", "John"));                 Customer customer;                 if ((customer = dbm.loadObject(new Customer("Smith"))) != null)            {              customer.getSupport().add(new Support(...));                     dbm.saveObject(customer);            }                 Collection<Customer> list = dbm.loadObjects(new ArrayList<Customer>(), Customer.class);          ...        }

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