Hibernate version: 3.2.6.ga
Hibernate annotations version: 3.3.1.GA
Name and version of the database you are using: Oracle 10g
Hi,
I have the following
@Entity Article class:
Code:
@Entity
public class Article implements Serializable{
...
@OneToMany()
@JoinTable(name = "x_art_intr",
joinColumns = @JoinColumn(name = "xartintr_art_id"),
inverseJoinColumns = @JoinColumn(name = "xartintr_intr_id"),
uniqueConstraints = @UniqueConstraint(columnNames = {"xartintr_art_id", "xartintr_intr_id"}))
@CollectionId(columns = @Column(name = "xartintr_id", nullable = false), type = @Type(type = "long"), generator = "my_seq")
@SequenceGenerator(name = "my_seq", sequenceName = "seq")
public Collection<Interest> getInterests(){
...
}
The
hbm2ddl generates the following:
Code:
create table x_art_intr (
xartintr_art_id number(19,0) not null,
xartintr_intr_id number(19,0) not null,
xartintr_id number(19,0) not null,
primary key (xartintr_id),
unique (xartintr_art_id, xartintr_intr_id),
unique (xartintr_intr_id)
);
As you see this will cause problems.
Where does the unique (xartintr_intr_id) come from ?
regards,
Tim