7 Replies Latest reply on Feb 10, 2008 5:05 AM by Carsten Hoehne

    How to generate annotated Java classes from hbm.xml files

    Carsten Hoehne Master

      Hello,
      we have a couple of old projects. The mapping is described in hbm.xml files.
      We wish to migrate this to annotated Java classes.
      We performed theses steps:
      1. We generated a hibernate console configuration for our project.

      2. opening hibernate perspective

      3. Run / hibernate code generation

      4. filling out the dialog on the main tab choosing the console configuration and selecting an output directory
      on the exporters tab selecting Java 5 syntax and domain code generation

      5 Run

      Code is generated but without annotations. so we specified in step 4 generate ejb3 annotations. But this results in the following error and no code is generated.

      org.hibernate.tool.hbm2x.ExporterException: Error while processing template pojo/Pojo.ftl
      Error while processing template pojo/Pojo.ftl
       freemarker.core.InvalidReferenceException: Expression pojo.generateManyToOneAnnotation is undefined on line 11, column 3 in pojo/Ejb3PropertyGetAnnotation.ftl.
       Expression pojo.generateManyToOneAnnotation is undefined on line 11, column 3 in pojo/Ejb3PropertyGetAnnotation.ftl.
       freemarker.core.InvalidReferenceException: Expression pojo.generateManyToOneAnnotation is undefined on line 11, column 3 in pojo/Ejb3PropertyGetAnnotation.ftl.
       Expression pojo.generateManyToOneAnnotation is undefined on line 11, column 3 in pojo/Ejb3PropertyGetAnnotation.ftl.
      

      We are using JBoss Tolls 2.0.0GA
      The projects we are trying to convert are JSF Projects created with the former Exadel studio.

      Is it possible to convert our hbm.xml files to annotatd lava classes?