© Anghel Leonard 2020
A. LeonardSpring Boot Persistence Best Practiceshttps://doi.org/10.1007/978-1-4842-5626-8_8

8. Calculating Properties

Anghel Leonard1 
Banesti, Romania

Item 77: How to Map Calculated Non-Persistent Properties

This item is about mapping calculated non-persistent properties of an entity based on the persistent entity attributes. It uses the Book entity mapping shown in Figure 8-1.
Figure 8-1

Book class diagram

Each book has a price mapped via the persistent field, called price. And, based on the price, the developer must calculate the value of the non-persistent field, discounted. This is the price with a discount applied. Let’s ...

Get Spring Boot Persistence Best Practices: Optimize Java Persistence Performance in Spring Boot Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.