Java数据访问框架:MyDAOurite

jopen 10年前

MyDAOurite 是一个轻量的数据访问框架。 MyDAOurite是一个数据持久层(ORM)框架。支持自定义SQL,存储过程和高级映射。几乎消除所有的JDBC代码和手动设置参数。另外也可以调用远程服务器端的MyDAOurite。

查询输出到JavaBean中

 MyDataSourceBuilder.build("classpath:MyDataSourceConfig.json");  MyDAO dao = MyDAOFactory.getDAO();  Staff staff = dao.executeQuery("select * from off_staff where id=#{0}", new Object[]{"012345"},Staff.class);  System.out.println(staff);  dao.close();

JavaBean:

public class Staff {      private String id;      private String name;      private String mobile;      private String email;      private int age;        public String getId() {        return id;      }        public void setId(String id) {        this.id = id;      }        public String getName() {        return name;      }        public void setName(String name) {        this.name = name;      }        public String getMobile() {        return mobile;      }        public void setMobile(String mobile) {        this.mobile = mobile;      }        public String getEmail() {        return email;      }        public void setEmail(String email) {        this.email = email;      }        public void setAge(int age) {        this.age=age;      }        public int getAge() {        return this.age;      }        public String toString() {        StringBuffer buf = new StringBuffer();        buf.append("name=").append(name).append(", ");        buf.append("mobile=").append(mobile).append(", ");        buf.append("email=").append(email).append(", ");        buf.append("age=").append(age).append("");          return buf.toString();      }    }

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