What is Java domain model?

前端 未结 6 1442
-上瘾入骨i
-上瘾入骨i 2020-12-02 22:41

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

6条回答
  •  南方客
    南方客 (楼主)
    2020-12-02 23:19

    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.

提交回复
热议问题