Hi,
I'm sorry if my question is stupid, I am a bit new on this. I am searching for a solution on this for some time but I didn't find anything.
I have a database to save Articles that are tagged
I have the following tables (reduced to clarify the problem)
------
Article|
------
art_id |
title |
... |
------
----------
Tag |
----------
tag_name |
----------
----------------
Article_has_Tag |
----------------
art_id |
tag_name |
----------------
And I want to map this into 2 entities
Code:
@Entity
public class Tag implements Serializable{
@Id
private String name;
//getters and setters..
}
Code:
@Entity
@SecondaryTables({
@SecondaryTable(name="Article_has_Tag", pkJoinColumns={
@PrimaryKeyJoinColumn(name="id", referencedColumnName="art_id")})
})
public class Article implements IClusterable{
@Id
@GeneratedValue
@Column(name = "art_id", nullable = false)
private int id;
private String title;
@OneToMany
@JoinColumn(name="tag_name", referencedColumnName="tag_name",
table="Article_has_Tag")
private List<String> tags;
//getters and setters..
}
but I am not able to map it... this is my last try... and I got
org.hibernate.cfg.NotYetImplementedException: Collections having FK in secondary table
some help?
Thanks