• Post Reply Bookmark Topic Watch Topic
  • New Topic

JPA One to Many Uni - Many side without PK

 
Chaminda Amarasinghe
Ranch Hand
Posts: 413
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys,

I have 2 tables as follows.

Employee
-----
id (pk)
name

Address
-----
emp_id (fk to employee)
street

Note that
Employee can have multiple addresses.
address does not have id (pk) field so as per my understanding address can not be marked as entity.

Questions
What is the right annotation for Address,
What is the right annotation for Set<Address> addresses field in Employee classes.

Thanks in advanced.
Chaminda
 
Chaminda Amarasinghe
Ranch Hand
Posts: 413
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!