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.  [ 8 posts ] 
Author Message
 Post subject: How to get Hibernate to cascade save/update to collection?
PostPosted: Tue Mar 29, 2005 2:21 am 
Regular
Regular

Joined: Fri Oct 01, 2004 2:19 am
Posts: 111
Location: Melbourne, Australia
Hibernate version: 3.0rc1

How can I get Hibernate to persist entries in the objectMap below?
It seems that the cascade operation will not be performed if the
element type is not of an Entity/Component/Any type.

The mapping fragment below shows the mapping I use.

Mapping documents:
Code:
<class name="Project">
        <id/>
...
        <map name="objectMap"
             lazy="true"
             inverse="true"
             table="PROJ_OBJS"
             cascade="all,delete-orphan">
            <key column="PROJECT_ID"/>
            <index-many-to-any id-type="int">
                <column name="OBJ_REF_TYPE" length="100"/>
                <column name="OBJ_REF_ID"/>
            </index-many-to-any>
            <element type="int" column="OBJ_COUNT" />
        </map>
</class>



Any idea how to get Hibernate to cascade the save/update and insertion
of collection elements?

_________________
Cheers,

Bonny

please don't forget to rate :)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 29, 2005 9:02 am 
Expert
Expert

Joined: Fri Feb 06, 2004 7:49 am
Posts: 255
Location: Moscow, Russia
Try with inverse="false" for objectMap

_________________
Leonid Shlyapnikov


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 29, 2005 11:44 am 
Senior
Senior

Joined: Tue Oct 21, 2003 8:15 am
Posts: 186
The "inverse" term confused the hell out of me for weeks. I think a better term should be choosen, as well as better explanations in the docs - this is really essential stuff.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 29, 2005 6:28 pm 
Regular
Regular

Joined: Fri Oct 01, 2004 2:19 am
Posts: 111
Location: Melbourne, Australia
shl wrote:
Try with inverse="false" for objectMap


Thanks!

I've tried this before, but must have had other problems with my mapping so it did not work.

_________________
Cheers,

Bonny

please don't forget to rate :)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 30, 2005 4:56 am 
Expert
Expert

Joined: Fri Feb 06, 2004 7:49 am
Posts: 255
Location: Moscow, Russia
nickvajberg wrote:
The "inverse" term confused the hell out of me for weeks. I think a better term should be choosen, as well as better explanations in the docs - this is really essential stuff.

About "inverse" exmplanation... There are the following docs in the Wiki area and in the reference documentation.

In the wiki area http://www.hibernate.org/Documentation/InsideExplanationOfInverseTrue
"Chapter 21. Example: Parent/Child" exmplains inverse too http://www.hibernate.org/hib_docs/v3/reference/en/html/example-parentchild.html

_________________
Leonid Shlyapnikov


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 06, 2005 9:18 pm 
Beginner
Beginner

Joined: Fri May 06, 2005 2:37 pm
Posts: 39
Why don't cascades solve this problem? It would seem that, if I set cascade="all", then I could save the inverse side, and when the save gets to the non-inverse object (via cascade), the relationship would get saved then.

Does the cascade somehow not touch relationships?


Top
 Profile  
 
 Post subject: Wiki ?
PostPosted: Wed Oct 19, 2005 10:16 am 
Beginner
Beginner

Joined: Tue Oct 18, 2005 10:47 am
Posts: 20
Location: Basel
I was just wondering why the link to the wiki wasn't working anymore (the one from shl's last post)
It would have helped me, I think. Was the target moved, renamed, deleted ?

Thank you,
Joel.


Top
 Profile  
 
 Post subject: Re: Wiki ?
PostPosted: Thu Oct 20, 2005 3:54 am 
Expert
Expert

Joined: Fri Feb 06, 2004 7:49 am
Posts: 255
Location: Moscow, Russia
joel wrote:
I was just wondering why the link to the wiki wasn't working anymore (the one from shl's last post)

Joel,

It looks like they removed this page from the Wiki. Maybe it become obsolete or removed accidentally. And Joel, there are still explanations in "Chapter 22. Example: Parent/Child"

Hibernate Team! Where is the wiki page explaning "Inverse True"? I cannot find it in the Wiki "List Directory". It used to have the following link: http://www.hibernate.org/Documentation/ ... nverseTrue

_________________
Leonid Shlyapnikov


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