摘要: 一、JpaRepository 1.要使Spring自动生成实现类的步骤 (1)配置文件xml 或java (2)dao接口继承JpaRepository接口 2.为什么dao接口继承JpaRepository接口及设置好@EnableJpaRepositories后,Spring就会自动生成实现类 阅读全文
posted @ 2016-04-01 18:20 shamgod 阅读(311) 评论(0) 推荐(0)
摘要: 一、结构 二、Repository层 1. 2. 3. 4. 5. 6. 三、domain层 1. 2. 四、配置文件及数据库文件 1. 2. 3.RepositoryTest-context.xml 4.schema.sql 5.test-data.sql 6. 五、测试文件 1. 2. 阅读全文
posted @ 2016-04-01 16:47 shamgod 阅读(258) 评论(0) 推荐(0)
摘要: 一、结构 二、Repository层 1. 2. 3. 4. 三、domain层 1. 2. 四、配置文件及数据库文件 1. 2.RepositoryTest-context.xml 3.schema.sql 4.test-data.sql 5.log4j.properties 五、测试文件 1. 阅读全文
posted @ 2016-04-01 16:39 shamgod 阅读(195) 评论(0) 推荐(0)
摘要: 一、注入EntityManagerFactory的方式 这种方式有一个问题,Aside from presenting a troubling code-duplication situation, it also means a new EntityManager is created every 阅读全文
posted @ 2016-04-01 13:59 shamgod 阅读(445) 评论(0) 推荐(0)
摘要: 一、EntityManagerFactory的种类 1.The JPA specification defines two kinds of entity managers:  Application-managed—Entity managers are created when an appl 阅读全文
posted @ 2016-04-01 13:29 shamgod 阅读(436) 评论(0) 推荐(0)
摘要: 一、结构 二、Repository层 1. 2. 3.以前是用HibernateTemplate,但现在的最佳实践是用Hibernate contextual sessions and not use HibernateTemplate at all. This can be done by wir 阅读全文
posted @ 2016-04-01 13:09 shamgod 阅读(1830) 评论(0) 推荐(0)
haha