# OneToMany with two id

**URL:** <https://discourse.hibernate.org/t/onetomany-with-two-id/2970>\
**Category:** Hibernate ORM\
**Created:** [July 17, 2019, 8:38am UTC](https://discourse.hibernate.org/t/onetomany-with-two-id/2970 "2019-07-17T08:38:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nir\_edelstein](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/nir_edelstein/32/700_2.png) [@nir\_edelstein](https://discourse.hibernate.org/u/nir_edelstein)\
**Post date:** [July 17, 2019, 8:38am UTC](https://discourse.hibernate.org/t/onetomany-with-two-id/2970/1 "2019-07-17T08:38:47Z")

</div>

I have two table with Embeddable

how I Connect between them :

table a | table b  
a a  
b b  
c

**class a**  
@EmbeddedId  
private aPk id;

@Embeddable  
**class aPK**  
private long a;  
private long b;

**class b**  
@EmbeddedId  
private bpk id;

@Embeddable  
**class bPk**  
private long a;  
private long b;  
private long c;
