-->
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: Unable to map a map with two converters
PostPosted: Tue Nov 11, 2014 12:33 pm 
Newbie

Joined: Sat May 14, 2005 11:19 am
Posts: 14
I try to map a map with key and value as value types, both using a converter (see below).
Hibernate 4.3.7 does not accept attributeName = "key" but requires it to be "key.<something>" (same for the value). Is this a bug?
If I use attributeName = "key.accountId" and attributeName = "value.campaignId" Hibernate tries to map the a value as a serializable type, which is wrong. Am I doing something wrong?

Is it possible that Hibernate simply does not implement this case? The implementation in CollectionPropertyHolder seems to be a bit empty... Isn't Hibernate JPA 2.1 compliant yet?

@Converts({
@Convert(attributeName = "key", converter = AccountIdConverter.class),
@Convert(attributeName = "value", converter = CampaignIdConverter.class)
})
@ElementCollection(fetch = FetchType.EAGER)
@Fetch(FetchMode.SELECT)
@CollectionTable(name = "cluster_campaign", joinColumns=@JoinColumn(name="cluster_id"))
@MapKeyColumn(name = "account_id", nullable = false)
@Column(name = "campaign_id", nullable = false)
private Map<AccountId, CampaignId> campaignIds = Maps.newHashMap();


Top
 Profile  
 
 Post subject: Re: Unable to map a map with two converters
PostPosted: Wed Nov 12, 2014 5:52 pm 
Newbie

Joined: Sat May 14, 2005 11:19 am
Posts: 14
Hibernate lacks the implementation of this feature. I provided a patch to add this functionality, so hopefully in the near future this will work.


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.