0 Replies Latest reply on Sep 8, 2006 12:42 PM by Samuel Mendenhall

    Generating hbm from Annotated Entity Beans

    Samuel Mendenhall Apprentice

      I hope this is an acceptable place to post this question versus another forum.

      My Goal: Generate hibernate mapping xml files from my Annotated Entity beans so I can use them in a non web application.

      Here is what I've tried. I think I just need to be steered on the right track.




       <hibernatetool destdir="/opt/jboss-seam-1.0.1.GA/examples/dvdstore/build/generated" >
       <ejb3configuration />
       <classpath>
       <!-- it is in this classpath you put your classes dir,
       and/or ejb3 persistence compliant jar -->
       <path location="/opt/jboss-seam-1.0.1.GA/examples/dvdstore/build/classes" />
       </classpath>
       <!-- list exporters here -->
       <hbm2cfgxml ejb3="true" />
       <hbm2hbmxml destdir="/opt/jboss-seam-1.0.1.GA/examples/dvdstore/build/generated" />
       </hibernatetool>
       </target>
      


      Whether I include the <hbm2hbmxml.... /> or not the mappings aren't generated in the hibernate.cfg.xml.

      Ant output:

      
      generatehbm:
      [hibernatetool] Executing Hibernate Tool with a EJB3 Configuration
      [hibernatetool] 1. task: cfg2cfgxml (Generates hibernate.cfg.xml)
      [hibernatetool] Sep 8, 2006 11:15:31 AM org.hibernate.ejb.Version <clinit>
      [hibernatetool] INFO: Hibernate EntityManager 3.2.0.CR1
      [hibernatetool] Sep 8, 2006 11:15:31 AM org.hibernate.cfg.annotations.Version <clinit>
      [hibernatetool] INFO: Hibernate Annotations 3.2.0.CR1
      [hibernatetool] Sep 8, 2006 11:15:31 AM org.hibernate.cfg.Environment <clinit>
      [hibernatetool] INFO: Hibernate 3.2 cr2
      [hibernatetool] Sep 8, 2006 11:15:31 AM org.hibernate.cfg.Environment <clinit>
      [hibernatetool] INFO: hibernate.properties not found
      [hibernatetool] Sep 8, 2006 11:15:31 AM org.hibernate.cfg.Environment buildBytecodeProvider
      [hibernatetool] INFO: Bytecode provider name : cglib
      [hibernatetool] Sep 8, 2006 11:15:31 AM org.hibernate.cfg.Environment <clinit>
      [hibernatetool] INFO: using JDK 1.4 java.sql.Timestamp handling
      [hibernatetool] Sep 8, 2006 11:15:32 AM org.hibernate.tool.hbm2x.Version <clinit>
      [hibernatetool] INFO: Hibernate Tools 3.1.0.beta5
      [hibernatetool] 2. task: hbm2hbmxml (Generates a set of hbm.xml files)
      
      BUILD SUCCESSFUL
      Total time: 3 seconds
      
      


      generated hibernate.cfg.xml file:
      <?xml version="1.0" encoding="utf-8"?>
      <!DOCTYPE hibernate-configuration PUBLIC
      "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
      "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
      <hibernate-configuration>
       <session-factory>
       <property name="hibernate.bytecode.use_reflection_optimizer">false</property>
       </session-factory>
      </hibernate-configuration>
      



      But there are no actual mappings generated?

      Guidance would be greatly appreciated.