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...
Now, we will look at the data access tier.
“Find all records” operation
We will jump in with the test case for the “find all records” method.
@RunWith( SpringJUnit4ClassRunner.class )@ContextConfiguration( locations = { "classpath:context.xml" } )@TransactionConfiguration( defaultRollback = true )@Transactionalpublic class CategoryDaoImplTest {@Autowiredprivate CategoryDao dao ;@Testpublic void testGetAll() {Assert.assertEquals(0L, dao.getAll().size());}}
We will then write the rival data access operation for the test above. The Hibernate 4 Session.createQuery method is used with SQL to retrieve all the ...
Ask