-->
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: HBM2JAVA - adding prefix to classname, hiding full construct
PostPosted: Tue Nov 22, 2005 7:54 am 
Beginner
Beginner

Joined: Tue Nov 22, 2005 6:55 am
Posts: 41
Hi,

Task:
Part1: having sql schema, generate mapping files and classes with xdoclet.
Part2: add a prefix _AAA and suffix _BBB to each generated class i java files
Part3: make the full constructor didn't appear
Part4: add implement word after each class name

I've found some examples, downloaded middlegen and now i have generated some hbms.xml files and .java files.

I use Ant. The problem is with Parts2-4.

Let me show u my ant script: I RUN: ANT CODEGEN

Code:
<target
      name="middlegen"
      description="Run Middlegen"
      unless="middlegen.skip"
      depends="init,fail-if-no-xdoclet-1.2,check-driver-present,panic-if-driver-not-present"
   >
      <mkdir dir="${build.gen-src.dir}"/>

      <taskdef
         name="middlegen"
         classname="middlegen.MiddlegenTask"
         classpathref="lib.class.path"
      />

      <middlegen
         appname="${name}"
         prefsdir="${src.dir}"
         gui="${gui}"
         databaseurl="${database.url}"
         initialContextFactory="${java.naming.factory.initial}"
         providerURL="${java.naming.provider.url}"
         datasourceJNDIName="${datasource.jndi.name}"
         driver="${database.driver}"
         username="${database.userid}"
         password="${database.password}"
         schema="${database.schema}"
         catalog="${database.catalog}"
         includeViews="false"
      >

       <hibernate
            destination="${build.gen-src.dir}"
            package="Hbm i klasy"
            genXDocletTags="true"
            javaTypeMapper="middlegen.plugins.hibernate.HibernateJavaTypeMapper"
         
       />
       </middlegen>

   </target>

////////////////////////////////////////////////////////////////////////////

<target name="codegen" depends="middlegen">
   <taskdef name="hbm2java"
   classname="net.sf.hibernate.tool.hbm2java.Hbm2JavaTask"
   classpathref="lib.class.path"/>
   <hbm2java config="codegen.cfg.xml"
   output="${build.gen-src.dir}/generated/src/">
   <fileset dir="${build.gen-src.dir}">
   <include name="**/*.hbm.xml"/>
   </fileset>
   </hbm2java>
</target>


/////////////////////////////////////////////////////



The codegen.cfg.xml file:
Code:
<codegen>
<meta attribute="implements">org.hibernate.auction.model.Auditable</meta>
     <generate suffix="AAA_" renderer="net.sf.Hibernate.tool.hbm2java.BasicRenderer"/>
     <generate prefix="BBB_" renderer="net.sf.hibernate.tool.hbm2java.BasicRenderer"/>
     <generate renderer="net.sf.hibernate.tool.hbm2java.BasicRenderer">
       <param name="do-not-create-constructor">true</param>
     </generate>
   </codegen>



What is wrong???


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 22, 2005 8:55 am 
Beginner
Beginner

Joined: Tue Nov 22, 2005 6:55 am
Posts: 41
i have only successfully generated suffixes :-( using this:

Code:
<codegen>
    <meta attribute="implements">org.hibernate.auction.model.Auditable</meta>
    <generate renderer="net.sf.hibernate.tool.hbm2java.BasicRenderer"
         suffix="_AMG">
      </generate>
</codegen> 


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 22, 2005 10:39 am 
Beginner
Beginner

Joined: Tue Nov 22, 2005 6:55 am
Posts: 41
anybody there?

I also found that hbm2java makes class, function, variable names basing on sql schema, and I don't like these names.

Where should i look 4 help if not here?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 22, 2005 12:16 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
you could use the tools forum ? :)

and hbm2java does not do anything based on table/column names - that is middlegen that does that.

_________________
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.