Sukirtha wrote:
U can modify the .ftl files available inside the hibernate-tools.jar to suit your requirement. You can make almost any kind of change there to get your desired default behavior. Hibernate-tools.jar/hbm/many-to-one.ftl file would be a good place to start looking
Thanks for the answer,
I knew I can modify the template files, but I was more interested in a build in solution. In this thread from September 2006 Max said that at this time it doesn't exist, but might be added later...
http://forum.hibernate.org/viewtopic.ph ... ht=cascadeIn this thread the user Arnon posted his solution where he in ant defined how to do this :
Quote:
<!-- Edit the HBM files for cascade attributes -->
<replaceregexp byline="true"
match="(set name=.billItems. inverse=.true.)"
replace="\1 cascade="all"">
<fileset dir="${model.dir}/hbm">
<include name="Bill.hbm.xml"/>
<include name="BillLineItem.hbm.xml"/>
</fileset>
</replaceregexp>
<replaceregexp byline="true"
match="(many-to-one .* fetch=.select.)"
replace="\1 cascade="save-update,persist"">
<fileset dir="${model.dir}/hbm">
<include name="BillItem.hbm.xml"/>
</fileset>
</replaceregexp>
But if you have a lot of tables this is really time consuming work...
Any updates on this Max?
Thanks in advance,
Jacob