How does inline annotation affect the database?
This does not affect him at all. At the ORM provider level, all fields from the inline object are merged with the parent object and are processed as if they were declared there all the time. In other words, it works as if you literally copied all fields, receivers, and setters into an object containing an embedded object.
How should SQL queries change?
They will not. You do not need to change anything. See above.
What is a typical use case for annotation annotations?
Sometimes you have a huge table with several columns (especially with legacy databases). However, some columns are logically related to each other (for example, street, city and phone number in the CUSTOMER table). If you do not want to create an object with all fields, you create a built-in Address object. This way you logically group the address columns into an object instead of having the same number of POJOs with a flat list of fields.
Using embedded objects is considered good practice, especially when a strong 1-1 relationship is found.
Tomasz Nurkiewicz
source share