How to map calculated properties with JPA and Hibernate
JPA doesn’t offer any support for derived property so you’ll have to use a provider specific extension. As you mentioned, @Formula is perfect for this when using Hibernate. You can use an SQL fragment: @Formula(“PRICE*1.155”) private float finalPrice; Or even complex queries on other tables: @Formula(“(select min(o.creation_date) from Orders o where o.customer_id = id)”) private … Read more