Hello.
I have one problem, I can't solve.
So, I have a list of articles, that user has visited:
@ManyToMany(cascade = {CascadeType.PERSIST, CascadeType.MERGE})
@org.hibernate.annotations.CollectionOfElements
@JoinTable(
name = "t_profile_visited_articles",
joinColumns = {@JoinColumn(name = "f_profile_id")},
inverseJoinColumns = {@JoinColumn(name = "f_article_id", unique = false)},
uniqueConstraints = {@UniqueConstraint(columnNames =
{"f_profile_id", "f_article_id", "f_position"})}
)
@org.hibernate.annotations.IndexColumn(name = "f_position")
private List<Article> visitedArticles = new ArrayList<Article>();
Generated SQL:
create table t_profile_visited_articles (
f_profile_id int8 not null,
f_article_id int8 not null,
f_position int4 not null,
primary key (f_profile_id, f_position),
unique (f_profile_id, f_article_id, f_position),
unique (f_article_id)
);
The problem I see is because of "unique (f_article_id)". I tried set up unique=false in JoinCoulmn, but it doesn't work.
Does anyone know how it's possible to prevent creating this unique constraint?
Thank you.
|