- 授权协议: Apache
- 开发语言: Java
- 操作系统: 跨平台
- 软件首页: https://git.oschina.net/haopeng/simple-orm
- 软件文档: https://git.oschina.net/haopeng/simple-orm/blob/master/README.md?dir=0&filepath=README.md&oid=c77457ce768f467565abe6b507be6cc7660dd084&sha=ca570192366621704da5e627fa1226cccf88407a
软件介绍
基于 Spring-JDBC 和 javax.persistence 注解的简易 ORM 的封装。支持多数据源,通过简单的常规的 Spring 的配置就可以轻松实现,对代码无侵入。
//定义数据映射实体类
@Table(name="sys_user") // 设置对应的表名
@TargetDataSource(name="hueDataSource") //如果需要支持多数据源,添加此注解
public class SysUser implements Serializable {
@Id //设置为主键值
@Column(name="id") //设置数据库中对应的字段名
private Long userId;
@Column(name="status") // 设置数据库中对应的字段名
private boolean status;
@Column(name="user_name")
private String userName;
@OrderBy(value="DESC") //设置默认的排序字段,在查询时如果没有设置就按默认的排序方式查询;
@Column(name="create_date")
private Date createDate;
@Column(name="sex")
@Enumerated(EnumType.ORDINAL) //此处为枚举属性;@Enumerated(EnumType.STRING):以枚举的名称存储;@Enumerated(EnumType.ORDINAL):以枚举的ORDINAL存储;(如果不写默认按名称存储)
private Sex sex;
}
//定义DAO操作
@Repository //通过spring注解自动加载到 bean 容器中
public class SysUserDao extends BaseDaoAdapter<SysUser>{
// 实现对当前dao操作的扩展
//根据名称模糊查询(样例)
public List<SysUser> like(String name) throws SQLException {
return getQuery().likeProperty("userName", "hao").list();
}
// 更新用户名称
public Integer updateUserName(String userName,int userId) throws SQLException {
return getUpdater().equalProperty("userId", userId).setProperty("userName", userName).update();
}
}
Developing Large Web Applications
Kyle Loudon / Yahoo Press / 2010-3-15 / USD 34.99
As web applications grow, so do the challenges. These applications need to live up to demanding performance requirements, and be reliable around the clock every day of the year. And they need to withs......一起来看看 《Developing Large Web Applications》 这本书的介绍吧!
