hi,
I am trying to generate my xxx.hbm.xml file via ReverseEngineering from the database...
I have a need where I need to generate a Many-To-One tag as follows..
Code:
.....
<many-to-one name="user" class="com.test.User" fetch="select" insert="false" update="false" >
<column name="USER_ID" precision="10" scale="0" />
</many-to-one>
.... ( other entries omitted for clarity )
What I'm currently getting is
Code:
.....
<many-to-one name="user" class="com.test.User" fetch="select" >
<column name="USER_ID" precision="10" scale="0" />
</many-to-one>
.... ( other entries omitted for clarity )
How do I get hbm2hbmxml to include the
update="false" and
insert="false" attributes in the many-to-one tag ?
I am using maven3-hibernate-plugin to generate the mapping files..
Code:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>hibernate3-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<components>
<component>
<name>hbm2hbmxml</name>
<implementation>jdbcconfiguration</implementation>
<outputDirectory>target/classes</outputDirectory>
</component>
</components>
<componentProperties>
<console>false</console>
<configurationfile>target/hibernate3/generated-mappings/hibernate.cfg.xml</configurationfile>
<jdk5>true</jdk5>
<ejb3>false</ejb3>
<packagename>com.test</packagename>
<format>true</format>
<haltonerror>true</haltonerror>
</componentProperties>
</configuration>
<executions>
<execution>
<id>generate-xml-files</id>
<phase>generate-resources</phase>
<goals>
<goal>hbm2hbmxml</goal>
</goals>
</execution>
</executions>
</plugin>
I looked at the many-to-one.hbm.ftl file to see how its being set. It has the following entries.
Code:
<#if !property.updateable>
update="false"
</#if>
<#if !property.insertable>
insert="false"
</#if>
But I'm not able to figure out where the value for property is being set and if I will have a way to set the updateable and insertable fields in the property
Any help is appreciated...