Using the script below, Roo generates repository/DAO layer containing Book.java (javabean), BookRepository.java (interface), and some .aj files (Non-editable).
I package the DAO layer as .jar file and I use it as follow on another project (Without Spring Roo):Code:... entity jpa --class ~.Book --activeRecord false field date --fieldName rentalDate --type java.util.Date field number --fieldName isbn --type java.lang.Integer field string --fieldName title repository jpa --interface ~.BookRepository
Now, I need to introduce custom methods to perform more complex data access but I want to keep access still coming from the same interface, eg.Code:ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("classpath*:META-INF/spring/applicationContext*.xml"); BookRepository bookRepo = (BookRepository)springContext.getBean("BookRepository"); bookRepo.saveAndFlush(entity);
However, I do not know where to put the implementation of the method since there is no Java class where I can put the implementation (I only have Book.java and BookRepository.java), furthermore BookRepository.java demands me to specify @Query.Code:bookRepo.doSomething(bookId)
If you have thought about this scenario when designing Spring Roo, please help.
Thank you.


Reply With Quote
