Hibernate Tip: How to Share the Primary Key in a One-to-One Association

Опубликовано: 07 Октябрь 2024
на канале: Thorben Janssen
4,801
106

Get more recipes like this one in my new book Hibernate Tips: More than 70 solutions to common Hibernate problems: https://goo.gl/XfywNk

I got the following question on my blog, so let’s talk about it today: I need to map a one-to-one association in which the primary key value of one entity is also used as the primary key value of the other entity. How can I map that with JPA or Hibernate?
JPA and Hibernate provide great support for that. You just need to add 1 annotation to your association mapping.

If you like this video, please give me your thumbs up and share it with your friends and co-workers.

Like my channel? Subscribe!
➜ http://bit.ly/2cUsid8

Join the free Member Library:
https://goo.gl/dtyIIC

Read the accompanying post: https://www.thoughts-on-java.org/hibe...

Want to connect with me?
Blog: http://www.thoughts-on-java.org/
Twitter:   / thjanssen123  
Facebook:   / thoughtsonjava