-->
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.  [ 4 posts ] 
Author Message
 Post subject: Middlegen cascade
PostPosted: Fri May 06, 2005 2:41 pm 
Beginner
Beginner

Joined: Fri May 06, 2005 2:37 pm
Posts: 39
I used the Eclipse Middlegen plugin to generate my Java files from my database, as a first development step.

In looking through the hbm files, I notice that Middlegen put cascade="all" in all the inverse collections, which I assume means I can save either side of a collection, and have it persist correctly.

It would seem that all objects in those collections will always try to save, but that seems like a lot of work. Is this a good thing, or do I need to go back and be more judicious?


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 06, 2005 5:07 pm 
Beginner
Beginner

Joined: Sun Jan 16, 2005 5:45 pm
Posts: 24
Location: Atlanta
Quote:
Is this a good thing, or do I need to go back and be more judicious?


I would assume that you would need to be “more judicious” in the use of Cascade = “All”. Have you seen link: http://hibernate.org/98.html?cmd=prntdoc

Excerpt:
Quote:
Currently setting the cascading options on the relationships is not possible (will be in the near future) so you can post process the hbm files to select the appropriate setting. The following Ant target illustrates one approach using the replaceregex Ant task.

Code:

<target name="hbm2java"
   description="Generate .java from .hbm files." depends="init">
   <property name="hbm.dir" location="${build.generate.dir}/com/mappings/"/>
           
   <replaceregexp
    match='cascade="none"'   
    replace='cascade="all"'
    byline="true">
    <fileset dir="${hbm.dir}" includes="MapRequest.hbm.xml,MapRun.hbm.xml" />
   </replaceregexp>


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

Joined: Fri May 06, 2005 2:37 pm
Posts: 39
pbaker01 wrote:

I would assume that you would need to be “more judicious” in the use of Cascade = “All”. Have you seen link: http://hibernate.org/98.html?cmd=prntdoc

Excerpt:
Quote:
Currently setting the cascading options on the relationships is not possible (will be in the near future) so you can post process the hbm files to select the appropriate setting. The following Ant target illustrates one approach using the replaceregex Ant task.



I did see that, but the Ant task seems to go the other way: replacing all "none" with "all." That's the opposite of what I'm seeing. I wasn't sure if the docs were out of date, or if I misread the regexp.


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 06, 2005 11:08 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Depends on what version of Middlegen your using. In later versions, there is an Ant option to set the type of cacade option you want for your collections. I am not sure what MiddlegenIDE is doing though - I assume it setting that property as 'all' cascade is likely to be more common than not.


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