1,635 views
This issue divides developers into two camps: some believe that it is more important to correctly compose the object model and let the JPA layer decide how to optimally execute the query. And others say that "the database will always outlive the application" and that an initially correct data structure makes data access faster regardless of whether we use JPA or not. If you unconditionally follow one of the approaches, then either the developers who try to adapt JPA to the database suffer, or the database administrators who are forced to "catch" queries that slow down, and sometimes both at the same time. In this report, we will consider the pros and cons of different approaches to developing a data access layer in applications. The first is from the JPA object model, the second is from a normalized database. We will talk about the pros, cons, and common points in both approaches, as well as the importance of tools when using one or another approach. We will talk about when it can be useful to enable full database regeneration (HBM2DDL), and when it is better to disable it. We'll also discuss how you can tell from the database schema that the authors used Hibernate, even without seeing the application code.