-->
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: Constructors prob. with new hibernate-tools-3.1.0.alpha5
PostPosted: Tue Sep 27, 2005 10:18 am 
Newbie

Joined: Mon Sep 26, 2005 8:43 am
Posts: 16
Hi I am newbie to Hibernate. I got to upgrade the Hibernate version from 2.1.6 to 3.

While upgrading to HB 3, I had to replace the hbm2java task[net.sf.hibernate.tool.hbm2java.Hbm2JavaTask] with hibernatetool[org.hibernate.tool.ant.HibernateToolTask]

Code:
<taskdef
               name="hibernatetool"
               classname="org.hibernate.tool.ant.HibernateToolTask"         
               classpathref="hibernate.lib"/>

           <hibernatetool destdir="${hibernate.build}">             
               <configuration>
                     <fileset dir="${hibernate.src}">
                        <include name="**/*.hbm.xml" />
                     </fileset>                                     
               </configuration>
               <hbm2java/> <!-- generate default .java files -->
               
           </hibernatetool>

The earlier tool hbm2java task[net.sf.hibernate.tool.hbm2java.Hbm2JavaTask] generated following three kinds of constructors for my *.hbm.xml files.

1. Full
2. Default
3. Minimal
4. Many other Customer Constructors

The new tool just generates

1. Default
2. Constructor with primary id key

FYI: I am making use of hibernate-tools-3.1.0.alpha5 version.

Please guide how should I generate all those constructors that i used to get generated by Hbm2JavaTask.

_________________
--Beejal


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 27, 2005 10:46 am 
Expert
Expert

Joined: Tue Oct 05, 2004 9:45 am
Posts: 263
i think the HB3-hbm2Java-Tool doesn't generate the missing constructors at the moment.
I've promissed max to provide a patch which includes the constructor-creation but wasn't able to do so (first a lot of work, then vacation - but not at home).

Sorry for my slowness :( i'll try to provide a patch as soon as possible.

gtx
curio


Top
 Profile  
 
 Post subject: Full Constructor code in PojoConstructor.vm commented ! Why?
PostPosted: Fri Sep 30, 2005 5:28 am 
Newbie

Joined: Fri Sep 30, 2005 5:13 am
Posts: 1
Code:
##    /** full constructor */
##    public $c2j.getDeclarationName($clazz)($c2j.asParameterList($c2j.getPropertyClosureForFullConstructor($clazz))) {
###if(!$c2j.getPropertyClosureForSuperclassFullConstructor($clazz).isEmpty())
##        super($c2j.asArgumentList($c2j.getPropertyClosureForSuperclassFullConstructor($clazz)));       
###end
###foreach($field in $c2j.getPropertiesForFullConstructor($clazz)) 
##        this.$field.Name = $field.Name;
###end
##    }



The code to generate the full constructor is commented out in PojoConstructors.vm in CVS.

1. Is there any specific reason for this?

2. Is it safe to uncomment this and use it to generate the full constructor?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 30, 2005 6:29 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
try and see if it works for you.

its commented out because its not complete with respect to inheritance and guaranteed ordering.

_________________
Max
Don't forget to rate


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.