What is Java domain model?

A Domain model is a conceptual model of the problem domain. By "java domain model" they just mean the java classes representing that model. There's nothing specific to java in the concept.

See also Domain Driven Design for an approach to focusing your development on the business domain needs.


Michael Borgwardt's answer "A domain model (the term is not at all Java specific) is a class" is wrong. I am very surprised so many agree with that answer.

A domain model is all the classes that model the behavior of the solution. It is the minimum necessary to accomplish the required behavior. The domain model is free of UI and persistence functionality (unless the problem revolves around UI or persistence).

I have seen domain model implemented in one class but that is not the design of an object-oriented solution. In an object-oriented domain model, each concept has its own class that implements the behavior required of that concept and contains the necessary fields to maintain the state of the class.


A domain model (the term is not at all Java specific) is a class that models something in the problem domain, as opposed to a class that exists for technical implementation reasons.

Domain model instances often need to be persisted in a database, and in Java, they typically conform to the Java Beans specification, i.e. they have get and set methods to represent individual properties and a parameterless constructor. Spring and other frameworks allow you to access these properties directly in your JSPs.

For example, in a shop application, some of your domain model classes would be Product, Order, ShoppingCart and Customer.