O'Reilly logo

Drools JBoss Rules 5.0 Developer's Guide by Michal Bali, Bogdan Brinzarea

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Repositories

The infrastructure for the persistence layer is almost set up (only the transaction setup is missing). We can implement the repositories that will be responsible for persistence and lookup of the domain objects. Let's start with JPACustomerRepository . JPACustomerRepository uses EntityManager to find a customer by customerUuid or firstName and lastName. It is also used to add a new customer or update an existing one.

@Repository public class JPACustomerRepository implements CustomerRepository { @PersistenceContext(unitName="entityManagerFactory") private EntityManager em; public Customer findCustomerByUuid(String customerUuid) { return em.find(Customer.class, customerUuid); } public List<Customer> findCustomerByName(String firstName, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required