I've got two tables A
and B
with simple PK's.
@Entity
public class A {
@Id
public int idA;
}
@Entity
public class B {
@Id
public int idB;
}
I want to map a new association class AB that simply stores the relations between A
and B
, with composite PK idA
+idB
. AB
doesn't have any extra columns, just the relation between idA
and idB
.
Is it possible to map AB
using a single class? I want to avoid having to create a new ABId
class just to use it as @IdClass
or @EmbeddedId
in AB
, and I don't want to map this with a @ManyToMany
association on A
or B
.