|
Same problem with hibernate version 4.2.8.FINAL. My case is similar:
@Entity
@Table(name="LETTERS_OF_GUARANTEE")
public class LetterOfGuarantee extends EntityBase {
@ManyToOne(optional = false)
@JoinColumn(name="CUSTOMER_ID")
private Customer customer;
...
...
@CollectionTable(name="LETTERS_OF_GUARANTEE_AMDC")
@ElementCollection(fetch=FetchType.EAGER)
@Column(name="AIRPORT_ID")
private Set<Airport> amdcAirports;
...
...
After ddl, the following primary key is created as expected: PRIMARY KEY ("LETTER_OF_GUARANTEE_ID", "AMDC_AIRPORTS_ID")
Also, another unique index is created (which is not expected because this does not allow records with the same AMDC_AIRPORTS_ID across the table. Not only for the same master table ID):
CREATE UNIQUE INDEX "UK_NDKRX9Y79EWUPQCCJV522DNQW" ON "LETTERS_OF_GUARANTEE_AMDC" ( "AMDC_AIRPORTS_ID" )
|