-->
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.  [ 1 post ] 
Author Message
 Post subject: "True Maps" with @MapKeyManyToMany and @Cascade's
PostPosted: Fri Aug 17, 2007 6:49 pm 
Newbie

Joined: Wed Jan 24, 2007 12:48 pm
Posts: 5
Hibernate version: 3.2.5.ga
Hibernate annotations 3.3.0.ga

I had a problem with a Map relationship between three entites,
they were mapping this way:
Code:
   /**
     * @return Regresa el valor de listasPorZona.
     */
    @CollectionOfElements
    @MapKeyManyToMany
    @LazyCollection(value = LazyCollectionOption.FALSE)
    @Cascade(org.hibernate.annotations.CascadeType.ALL)
    public Map<CentroEmbarcador, ListaPrecios> getlistasCentroEmbarcador() {
        return listasCentroEmbarcador;
    }

As shown in the hibernate annotation reference part 2.4.6.2.2. Map. But I added the @LazyCollection and @Cascade annotations since I wanted to cascade the save operation on the owner of this map to the values of the map.

The problem was that the @Cascade didn't work cause save threw the
org.hibernate.TransientObjectException.

But I found in this thread http://forum.hibernate.org/viewtopic.php?t=974839 (apparently unrelated, since that guy seems to have a different prob lem) that Emmanuel recommended to change the @CollectionOfElements for @ManyToMany. I did the change and voila! @Cascade worked.

My question is why? Whats the semantics of @CollectionOfElements with @MapKeyManyToMany?

regards,

Miguel


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

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.