Member-only story

Do you really need entity classes?

Entities are boring, without them you can sometimes save time

Marian C.
Better Programming

A browser is a convenient tool for data visualization. In a browser, data can be presented in interactive charts or tables with relatively little effort.

One can choose any imaginable chart from many ready-to-use options (for example look at https://observablehq.com/@d3/gallery or https://plotly.com/javascript/). So in companies, it is common to use custom web applications for monitoring and data analysis.

The backend of a web application can be written in any language. Java has some advantages over other options. If a preconfigured application server, e.g. Tomcat, is used, the deployment is easy. If the backend only relays the data between the database and the authorized users, its development is quick.

Imagine an application displaying statistics derived from a data warehouse — it displays the results of many SQL queries. The application has to be frequently refined according to new business needs. Would it need some kind of individual class for loading and serializing the results of each query?

When the results of a query are joined products that have to be converted into arrays of objects containing collections of nested objects, entities with JPA queries produce the shortest…

Responses (6)

Write a response

I have added a longer answer to a reply on Andrei Dascalu's, but trust me. If you only take 1 architectural advice let it be this:
Do NOT tie your table scheme to your controller responses. You suddenly can't delete columns, change data, refactor etc…

Sorry but no, a dto is not an entity. An entity represents a table structure but a dto is just a representation of data passed across service (or even domain boundaries). It can aggregate data from several entities.

Sorry, On this aproach I see Anemic Models, No respect to Objects, no place for domain level, and levels mix...
A bit code to not use ORM.
Sorry.

Recommended from Medium

Lists

See more recommendations