Hello,
I'm trying to implement an integration test against an entity handled by JPA and a repository layer.
I did a reverse engineering of a database schema and then created the repository for each entity.
Creating the entities from a reversed engineered database schema:
Creating a repository for each entity of the schema:Code:database reverse engineer --package ~.domain --schema PUBLIC --testAutomatically --activeRecord false
Since the schema contains 117 tables I created an equal number of repositories with the repository jpa above command.Code:repository jpa --interface com.learnintouch.lms.data.domain.AddressRepository --entity com.learnintouch.lms.data.domain.Address
Question 1: Is this the way to proceed to have a repository layer and avoid the active record pattern ?
I then tried to create an integration test:
Question 2: How to expose a reference to the repository in the integration test ?Code:@Test @Transactional public void testSaveAndRetrieve() { AddressDataOnDemand dod = new AddressDataOnDemand(); Address address = dod.getRandomAddress(); assertNotNull(address.getId()); addressRepository.... }
I could not find the answer in the Spring Roo reference manual nor in the Spring Roo In Action book.


Reply With Quote
