Search⌘ K
AI Features

Develop the Business Service Tier

Explore how to develop the business service tier by implementing core operations such as find, create, edit, and remove in a one-to-one unidirectional relationship. Understand the role of mappers converting between entities and data access objects, and learn how the service manages identifiers internally without exposing them to the user interface.

We will begin working with the business service tier, seeing as the data access tier has been developed and is ready for integration.

“Find all records” operation

First, let’s look at the test for the find all records operation. Since this is the first function being tested, the other operations are still not developed and only the find all records operation can be tested with zero records returned when the table is empty.

Java
@RunWith( SpringJUnit4ClassRunner.class )
@ContextConfiguration( locations = { "classpath:context.xml" } )
@TransactionConfiguration( defaultRollback = true )
@Transactional
public class BookServiceImplTest {
@Autowired
private BookService service ;
@Test
public void testFindAll() {
Assert.assertEquals(0L, service.findAll().size());
}
}

Look at how to code the matching method in the business service. The data access tier uses entities, and the business service tier uses data access objects. ...