What is Java domain model?

John picture John · Feb 6, 2011 · Viewed 45.3k times · Source

I am studying a Spring book and they mention Java domain model.
What is that?

Answer

Michael Borgwardt picture Michael Borgwardt · Feb 6, 2011

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.