Domain Store Design Pattern
Start course
3h 59m

In this course, we will learn the concepts of microservice and spring framework with a focus on design patterns.

Learning Objectives

  • Learn about various design patterns

Intended Audience

  • Beginner Java developers
  • Java developers interested in learning how to Build and Deploy RESTful Web Services
  • Java Developers who want to develop web applications using the Spring framework
  • Java Developers who want to develop web applications with microservices
  • Java Developers who wish to develop Spring Boot Microservices with Spring Cloud


  • Basic Java knowledge

Hello, dear friends. In this video, we will examine the Domain Store Design Pattern. So, let's begin. Domain store is used for separating persistence from object model. A domain store is a set of persistence classes that transparently persist business objects. With domain store pattern, you can implement a custom domain store implementation, but this is quite a bit of work. Although few developers are likely to implement this pattern themselves, learning the pattern will help you learn how these products work. As you can see, the pattern has a lot of participants. ApplicationService is an application service object, and it interacts with persistable business objects. Persistable is an interface or base class that all business objects that would be persisted must implement. PersistenceManagerFactory creates and manages PersistenceManagers. PersistenceManager manages the persistence inquiries of the object model.

The PersistenceManager interacts with the StateManager not the business object. The PersistenceManager instructs the StateManager to update objects state when necessary. StateManager manages the state of persistible objects. The persistable object shares the responsibility for managing its state with the StateManager. The StateManager enforces transactional storage and retrieval of state from the data resource. You can think of StoreManager like a data gateway. It interacts with the data resource to perform CRUD operations. The StoreManager is a DAO, and encapsulates all the data resource mechanisms. Data resource is any resource service that manages data. It can be a relational database, object-oriented database, EIS and so on.

These are classes that are typical when implementing a domain store, but are not central to the pattern. Session façade is an entry point into the service layer, communicates with one or more application services. PersistMap contains the relationships among the objects and the mapping between persistable objects and the data resource. The transaction is an artifact of PersistenceManager, not an independent component. It's used to set transaction-oriented policies, and delimit transactions in non-managed environments. Query encapsulates a query. Typically, the extent of instances to query, filtering criteria, ordering, and parameter declarations. This pattern creates a robust persistence mechanism that is transparent to the business objects without using entity beans. This pattern allows many benefits of entity beans without the overhead of other entity bean services. It creates more robust and transparent persistence capabilities than the DAO pattern, and separates the persistence from the business objects.

The DAO pattern separates the persistence code from the business objects, but the pattern does not make the code transparent to the business objects. So, now we finish looking at the domain store design pattern. In the next lesson, we will start looking into the web service broker pattern. Until then, take care.


About the Author
Learning Paths

OAK Academy is made up of tech experts who have been in the sector for years and years and are deeply rooted in the tech world. They specialize in critical areas like cybersecurity, coding, IT, game development, app monetization, and mobile development.