Hello,
I'm working with Hibernate EntityManager 3.4.0.GA, Hibernate-Annotations 3.4.0.GA and Hibernate Core 3.3.0.SP1
In my model, I have 2
entities, User and FeedEntry, that I would like to associate in a Map.
For each Key in the Map (ie, a FeedEntry), I want to store some FeedEntryInfo defined by an
@Embeddable Class containing 2 boolean attributes : markedAsRead and markedAsStarred.
The mapping in the User class is defined below :
Code:
@CollectionOfElements()
@MapKey(columns={@Column(name="ID_FeedEntry")})
@JoinTable(name = "User_FeedEntries_Info", joinColumns = @JoinColumn(name = "ID_User"))
private Map<FeedEntry, FeedEntryInfo> feedEntriesInfo = new HashMap<FeedEntry, FeedEntryInfo>();
Unfortunately, I cannot find how to set the MapKey column to "ID_FeedEntry" (as I would have expected). Here is the generated SQL code :
Code:
create table User_FeedEntries_Info (ID_User bigint not null,
markedAsRead bit not null,
markedAsStarred bit not null,
mapkey_id bigint not null,
primary key (ID_User, mapkey_id))
As you can see, there is no such "ID_FeedEntry" column, but instead (and whatever I do), I get a "mapkey_id" column name.
How can I change this ?
Thank you in advance
Regards,
Xavier