A domain model is an object-oriented view of the business concepts an application needs, their relationships, and potentially their attributes. It captures information relevant to the application rather than reproducing every detail of the real world. A conceptual model can be as informal as a mental picture or as explicit as a UML class diagram. section 3.1.2
To design a model, work with domain experts to identify the main entities, their interactions, and the rules needed to preserve data integrity. The entities should encapsulate state and behavior. Keep non-business concerns out of their implementation, since the model is a central component reused across application functionality. section 3.1.2 section 3.1.3 section 3.2
Online auction model
An auction model can associate Bid directly with Item when each item is auctioned only once. A User can have separate Address objects and multiple BillingDetails, whose subclasses represent billing strategies. Category can have child categories and at most one parent; each Item belongs to at least one Category. These classes describe the persistent part of the model, not necessarily the whole application. section 3.1.3
Use the class diagram to follow the persistent auction classes and their relationships. section 3.1.3
In a Java implementation, business logic works with objects such as Item and Bid rather than directly with ResultSet rows and columns. Mapping metadata connects persistent classes and properties to database tables and columns; it can be expressed with annotations or XML. JPA providers such as Hibernate use mapping settings to load and store instances. section 1.1.3 section 3.0 section 5.0
The object and database models need not have the same granularity. A Java User can contain a finer-grained Address class even when address information is stored in separate columns of a USERS table. Inheritance and polymorphism can also shape the application model. A domain model is not mandatory: for a simple application, direct JDBC ResultSet access may be sufficient. section 1.2.1 section 1.1.3







