Develop the Data Access Tier
The data access tier is the second step in the process of developing a service.
We'll cover the following...
We'll cover the following...
Next, we will look at the data access tier. We will start with the test case for the get all records formula.
Find all records operation
Press + to interact
@RunWith( SpringJUnit4ClassRunner.class )@ContextConfiguration( locations = { "classpath:context.xml" } )@TransactionConfiguration( defaultRollback = true )@Transactionalpublic class PersonDaoImplTest {@Autowiredprivate PersonDao dao ;@Testpublic void testGetAll() {Assert.assertEquals(0L, dao.getAll().size());}}
Note how to write the imitating data access operation for the test directly above. The Hibernate 4 Session.createQuery
method is used with SQL to retrieve all records ...