What is the difference between business class and domain class? What is meant by persistent classes?
Persistent classes are classes in an application that implement the entities of the business problem (e.g. Customer and Order in an E-commerce application). Not all instances of a persistent class are considered to be in the persistent state. For example, an instance can instead be transient or detached.
A domain class represents a table column and it allows you to handle the column value as a Java object. In the Doma framework, a domain means all the values which a data type may contain. In short, a domain class is a user defined class that can be map to a column. The use of the domain classes is optional.
A domain object is often your entity class. For example, "Users" would be considered domain objects as they are a core element to the over all domain model. The domain model being a representation of all the key elements to your problem/system.
A domain class is a class from the Domain Model that Martin Fowler describes as follow in Patterns of Enterprise Application Architecture:
An object model of the domain that incorporates both behavior and data.
At its worst business logic can be very complex. Rules and logic describe many different cases and slants of behavior, and it's this complexity that objects were designed to work with. A Domain Model creates a web of interconnected objects, where each object represents some meaningful individual, whether as large as a corporation or as small as a single line on an order form.
And to me, there is no difference with a business class: a business object doesn't perform more or less business logic than a domain object (a domain model where business logic is implemented outside the domain objects is called an Anemic Domain Model, which is a pejorative term), domain objects and business objects are the same thing.
Finally, a persistent class is a class that can be... persisted which means transferring an in memory representation of information to a physical storage that will persist beyond the live of the JVM. Often, persistence is implemented using a database (but this is not the only solution, see for example object prevalence). Typical persistence operations include create, read, update and delete which are known as CRUD operations. Domain objects are very frequently persistent i.e you can perform CRUD operations on them through an API that hides the underlying details of the chosen persistence engine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With