-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: CollectionOfelements and MapKey: mapkey custom column name
PostPosted: Tue Nov 25, 2008 9:00 am 
Newbie

Joined: Thu Dec 18, 2003 4:13 am
Posts: 19
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


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 23, 2008 4:40 am 
Newbie

Joined: Thu Dec 18, 2003 4:13 am
Posts: 19
Hello,

Nobody answered...
Did anyone else faced this issue ?

Thank you in advance.

Regards,
Xavier


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.