摘要: 工具类:(泛型转化) 【例子】:超类public class GenericDAO<T> { private Class<T> entityClass; protected GenericDAO() { Type type = getClass().getGenericSuperclass(); T 阅读全文
posted @ 2016-04-26 14:40 Moka<TI 阅读(2666) 评论(0) 推荐(1) 编辑
摘要: 一般类上这么写@Transactional(readOnly=true) //配置事务 查询使用 只读public Demo{ //方法的写法 (增删改要写 ReadOnly=false 为可写) @Transactional (propagation=Propagation.REQUIRED,is 阅读全文
posted @ 2016-04-26 14:18 Moka<TI 阅读(3501) 评论(0) 推荐(0) 编辑
摘要: create:表示启动的时候先drop,再create create-drop: 也表示创建,只不过再系统关闭前执行一下drop update: 这个操作启动的时候会去检查schema是否一致,如果不一致会做scheme更新 validate: 启动时验证现有schema与你配置的hibernate 阅读全文
posted @ 2016-04-26 14:13 Moka<TI 阅读(116) 评论(0) 推荐(0) 编辑
摘要: 一:Hibernate 一对一连接表双向关联 1:模型介绍 一个人(Person)对应一个地址(Address)。 2:实体(省略getter、setter方法) public class Person11tab_sx { private int personid; private String n 阅读全文
posted @ 2016-04-26 14:08 Moka<TI 阅读(217) 评论(0) 推荐(0) 编辑