-->
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: Map generator issues for hibernate 2.1
PostPosted: Mon Apr 18, 2005 2:30 pm 
Beginner
Beginner

Joined: Mon Apr 18, 2005 10:25 am
Posts: 38
Location: Maryland
Are there any tricks to getting your ant task to generate the mapping files? I run the generate task and it says that it is completed but it only creates my jboss-service.xml that I also tell it to create but no mapping files. Do I need something else. I would think that if I was missing a library I would get an error. I am going crazy with this.

What is Hibern8te? I have seen this written and thought it a typo.
THANKS


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 18, 2005 9:28 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Assuming your talking about Xdoclet markup.

See this:

http://forum.hibernate.org/viewtopic.php?t=941274

It might help.


Top
 Profile  
 
 Post subject: complete build.xml
PostPosted: Tue Apr 19, 2005 2:43 pm 
Beginner
Beginner

Joined: Mon Apr 18, 2005 10:25 am
Posts: 38
Location: Maryland
Code:
<project name="HL_Hibernate"  default="compile" basedir="../../../.">

<property file="ant.properties" />

<property name="server.config"  value="default"/>
<property name="scr.dir"     value="${basedir}/src"/>
<property name="package.name"   value="hl/database"/>
<property name="compenent.name"   value="or/hibernate"/>
<property name="jboss.home"   value="/export/hl/COTS/jboss-4.0.1"/>
<property name="deploy.home"   value="${jboss.home}/server/default/deploy"/>
<property name="build.dir"   value="${basedir}/build"/>
<property name="build.classes.dir"   value="${build.dir}/classes"/>
<property name="build.database.classes.dir"   value="${build.classes.dir}/${package.name}"/>
<property name="build.database.classes.dir.map"   value="$build.database.classes.dir}/map"/>
<property name="package.src.dir"   value="${src.dir}/${package.name}/${compenent.name}/objects"/>

<path id="base.libraries">
  <fileset dir="${jboss.home}/lib">
     <include name="*.jar"/>
</path>

<target name="clean">
  <delete dir="${build.database.classes.dir}"/>
  <delete dir="${build.database.classes.dir.map}"/>
  <delete file="${build.classes.meta_inf.dir}/jboss-service.xml"/>
</target>

<target name="prepare">
  <mkdir dir="${build.database.classes.dir}"/>
  <mkdir dir="${build.database.classes.dir.map}"/>
</target>

<target name="compile" depends="clean,prepare">
  <javac scrdir="${package.src.dir}"    destdir="${build.database.classes.dir}"
classpath="${build.database.classes.dir}"
debug="on"  optimize="off"  deprecation="on">
  <classpath refid="base.libraries"/>
  </javac>
</target>

<taskdef name="hibernatedoclet"  classname="xdoclet.modules.hibernate.HibernateDocletTask" >
  <classpath refid="base.libraries"/>
</taskdef>

<target name="generate-mappings"   depends="compile">
  <hibernatedoclet
      destdir="${build.database.classes.dir.map}"
      excludetags="@version,@author,@todo,@see,@desc"
      addtags="@xdoclet-generated at ${TODAY}, @authore"
      force="true"
      verbose="true"
        <fileset dir="${package.src.dir}">
         <include name="*.java"/>  ***This has also been tried: **/*.java
         <include name="/exceptions/*.java"/>
         <include name="/dao/*.java"/>
        </fileset>
      <hibernate version="2.0" (also tried 2.1)   destinationfile="${0}.hbm.xml"/>

  <jbossservice
     destdir="${build.classes.meta_inf.dir}"
     serviceName="Hibernate"
     jndiName="jdbc/Sybase"
     dataSource="jdbc/Sybase"
     dialect="net.sf.hibernate.dialect.SybaseDialect"
     useOuterJoin="true"
     transactionManagerStrategy="net.sf.hibernate.transaction.JBossTransactionManagerLookup"
   trancactionStrategy="net.sf.hibernate.transaction.JTATransactionFactory"
    userTransacationName="UserTransaction"
    depends="jboss.jca:service=LocalTxCm, name=DefaultDS"/>
</hibernatedoclet>
</target>

<taskdef name="schemaexport" classname="net.sf.hibernate.tool.hbm2ddl.SchemaExportTask"/>
   <classpath refid="base.libraries"/>
<taskdef>

<target name="schemaexport">
    <schemaexport
       quiet="no"
       text="no"
       delimeter=";"
       output="schema-export.sql">
   <fileset dir="${build.database.classes.dir.map}">
      <include name="*.hbm.xml"/>
  </fileset>
  </schemaexport>
</target>

<target name="schemaupdate">
  <taskdef name="schemaupdate"
     classname="net.sf.hibernate.tool.hbm2ddl.SchemaUpdateTask"/>
      <classpath refid="base.libraries"/>
  <schemaupdate
     quiet="no"
    <fileset dir="${build.database.classes.dir.map}">
      <include name="*.hbm.xml"/>
   </fileset>
  </schemaupdate>
</target>


<target name="hibernate-sar"   depends="generate-mappings">
  <jar destfile="${build.dir}/hibernateStartup.jar">
   <fileset dir="${build.database.classes.dir}">
     <include name="/map/*.hbm.xml"/>
     <include name="*.class"/>
  </fileset>
   <metainf dir="${build.classes.meta_inf.dir}" >
     <include name="jboss-service.xml"/>
   </metainf>
  </jar>
     <antcall target=schemaexport" />
</target>

</project>

That is my whole build file.  I copied the example .java files from hibernte and put them in my src where my files were.  Of course, I changed the package.  I ran the generate-mappings task and it generated the .hbm.xml mapping files but only for the example classes.  Why is that.  I noticed that most of them extended a class Persistent but none of them had any of the hibernate xdoclet tags in them.  How did it generate these mapping files.  Why would it not ever again.  I am sure it is something small that I have overlooked but I've got nothing left to try.  All of my classes implement Serializable but don't extend anything.  They do all have no arg constructors.  I just don't get it.  What I have I missed?
Thank in advance.  You can also feel free to email me @ jacky@itmc-wo.com  if it is easier to correspond that way.

   


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 20, 2005 1:55 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Not sure what you have missed. XDoclet has a small test/example package for hibernate with it. Its to hard the diagnose the issue like this. Download one of the many examples around the traps and have a look see.


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.