OSChina 7-4(7月份第4周) 期推荐的开源软件是ActiveJDBC

 

OSChina 7-4(7月份第4周) 期推荐的开源软件是ActiveJDBC。ActiveJDBC 是一个快速和轻量级的 Java 的 ORM 小型框架,语法简单易于理解,同时支持多数据库链接。ActiveJDBC 采用Apache License 2.0 授权。

ActiveJDBC 的文档非常完善。基于以下原则设计:

  • 惯例重于配置(无配置)
  • 拥有 SQL 知识就足够了
  • 轻量级而且直观的代码
  • 无会话
  • 无持久层管理
  • 无 proxying

下面是一个简单的 Model 类:

public class Main {
    public static void main(String[] args) {
        new DB("corporation").open("com.mysql.jdbc.Driver", "jdbc:mysql://localhost/test", 
                "root", "p@ssw0rd");
        new DB("university").open("oracle.jdbc.driver.OracleDriver", 
                "jdbc:oracle:thin:@localhost:1521:xe", 
                "activejdbc", "activejdbc");

        Employee.deleteAll();
        Student.deleteAll();

        Employee.createIt("first_name", "John", "last_name", "Doe");
        Employee.createIt("first_name", "Jane", "last_name", "Smith");

        Student.createIt("first_name", "Mike", "last_name", "Myers");
        Student.createIt("first_name", "Steven", "last_name", "Spielberg");

        System.out.println("*** Employees ***");
        Employee.findAll().dump();
        System.out.println("*** Students ***");
        Student.findAll().dump();

        new DB("corporation").close();
        new DB("university").close();
    }
}

如果你在使用Maven,添加这些到你的pom中:

    <pluginRepositories>
        <pluginRepository>
            <id>ipsolutionsdev-plugin-snapshots</id>
            <name>IP Solutions Dev Snapshot Repo</name>
            <layout>default</layout>
            <url>http://ipsolutionsdev.com/snapshots/</url>
            <snapshots>
                <enabled>true</enabled>
                <checksumPolicy>warn</checksumPolicy>
                <updatePolicy>always</updatePolicy>
            </snapshots>
        </pluginRepository>
    </pluginRepositories>
    <repositories>
        <repository>
            <id>ipsolutionsdev-snapshots</id>
            <name>IP Solutions Dev Snapshot Repo</name>
            <layout>default</layout>
            <url>http://ipsolutionsdev.com/snapshots/</url>
            <snapshots>
                <enabled>true</enabled>
                <checksumPolicy>warn</checksumPolicy>
                <updatePolicy>always</updatePolicy>
            </snapshots>
        </repository>
    </repositories>

如果你没有使用Maven,可通过该URL下载: http://ipsolutionsdev.com/snapshots/activejdbc/

更多关于ActiveJDBC的详细信息,或者下载地址请点这里

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值