Hibernate version:
3.3
Name and version of the database you are using:
Oracle 10g
I have two entities which have a many to many relationship (Foo and Bar).
Using JPA, they are mapped like this: -
Code:
public class Foo {
........
@ManyToMany
@JoinTable(name="foos_bars", joinColumns = { @JoinColumn(name = "foo_id") },
inverseJoinColumns = { @JoinColumn(name = "bar_id") })
public List<Bar> getBars() {
return bars;
}
Code:
public class Bar {
.....
@ManyToMany(mappedBy="foos")
public List<Foo> getFoos() {
return foos;
}
}
I'm using hibernate.hbm2ddl.auto= create-update
The table generated has only two foreign keys (foo_id and bar_id) but no Primary key of it's own. How do I enforce the generation of primary key?
(My DBA insists strict referential integrity for all tables, and I'm using schema generation completely)