'Spring boot mapsId

Hi I using spring boot jpa and I need to use mapsid. There are not so much information about that and I wonder if anyone can help me understand how to use maybe link a simple code example where its 2 table that joins 1 table (oneToOne)



Solution 1:[1]

for a @OneToOne mapping, it is best to use @MapsId . There are certain benifits to this. You can avoid using @GeneratedValue to your child class. This is more efficient as no separate Generation of Primary key is required.

You can use same key for finding same normalized data over @OneToOne relation.

For detailed explanation and reference, please visit this site. One of the best explanation out there.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Asgar