As you know, for @Embedded / @Embeddable there are two main uses:
First and foremost: the separation of large classes of entities. In the database world, a large table (one with many columns) is in order. Violation of such a table can even worsen the situation and interfere with the principles of database design. In Java (or object-oriented languages), on the other hand, a large class is code smell . Here we would like to divide the classes, including entity classes, into smaller units. @Embedded / @Embeddable allows us to easily do this without breaking the database table.
Secondly, it allows you to reuse common mappings between objects. Let's say each table has simple versioning, with two columns containing the username of the person who changed the row, and the time it happened. You can then create an @Embeddable object that spans these lines, and then reuse it for all objects by inserting it (instead of repeating the variables corresponding to these columns in each object.)
source share