-->
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: generating manyToOne attributes via hbm2hbmxml
PostPosted: Thu Jan 26, 2012 3:55 pm 
Newbie

Joined: Tue Jan 16, 2007 4:55 pm
Posts: 6
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...


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.