-->
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.  [ 3 posts ] 
Author Message
 Post subject: Persisting a Map<Entity, Primitive>?
PostPosted: Tue Oct 24, 2006 8:56 am 
Newbie

Joined: Tue May 23, 2006 12:46 pm
Posts: 17
Is it possible to persist maps which have an entity as the key?

@CollectionOfElements
@MapKey(columns = { @Column(name = "key_value", nullable = false) })
public Map<PriceDescriptor, Double> getPriceMap()
{
return priceMap;
}

Marking the map as @OneToMany causes an error because java.lang.Double is not an entity.

Marking the map as @CollectionOfElements nearly works but fails to save at runtime because the new entities are transient and have not be persisted. Adding @Cascade(CascadeType.ALL) did not help.

Is there a way of making this work?

Thanks.
Ashley


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 24, 2006 9:17 am 
Newbie

Joined: Tue May 23, 2006 12:46 pm
Posts: 17
I see that this bug describes the same things and is marked as resolved.

http://opensource.atlassian.com/project ... se/ANN-408

Is there a way around the cascade problem when using @CollectionOfElements?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 25, 2006 11:56 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
nope you have to same them manually, which make sense I guess

_________________
Emmanuel


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.