EJPAJava的ORM框架
EJPA (Easier Java Persistence API) 是一个基于 Annotation ,无配置的 ORM 框架。
示例代码:
public static void main(String[] args)
{
DatabaseManager dbm = DatabaseManager.getDatabaseManager(…);
dbm.saveObject(new Customer("smith", "John"));
Customer customer = new Customer(“Smith”);
if ((customer = dbm.loadObject(customer)) != null)
{
customer.getSupport().add(new Support(…));
dbm.saveObject(customer);
}
Collection<Customer> list = new ArrayList<Customer>();
list = dbm.loadObjects(list, Customer.class);
…
}
评论