2 Replies Latest reply on Aug 28, 2009 10:26 AM by Coen Damen

    Hibernate mappings not picked up by Seam-gen

    Coen Damen Novice

      Hi,


      I am upgrading my application to Seam 2.2.0.GA using Jboss Tools 3 on Ganymede.


      I changed the seam-gen.reveng.xml in the jboss-seam-2.2.0.GA/seam-gen/hibernatetools folder using these entries:


      
      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE hibernate-reverse-engineering SYSTEM "http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd" >
      <hibernate-reverse-engineering>
      
        <type-mapping>
                      <sql-type jdbc-type="TIMESTAMP" hibernate-type="java.sql.Timestamp" />
                      <sql-type jdbc-type="DATE" hibernate-type="java.sql.Date" />
                      <sql-type jdbc-type="NUMERIC" hibernate-type="java.lang.Long" />
                      <sql-type jdbc-type="DECIMAL" hibernate-type="java.lang.Long" />
                      <sql-type jdbc-type="VARCHAR" length="1" not-null="true"
                              hibernate-type="java.lang.Character" />
                      <sql-type jdbc-type="VARCHAR" length="1" hibernate-type="char" />
                      <sql-type jdbc-type="VARCHAR" hibernate-type="string" />
              </type-mapping>
      
      </hibernate-reverse-engineering>
      
      



      However, when generating seam entities from Eclipse, the mappings are not applied.


      I still get java.util.Date iso java.sql.Date and BigDecimals iso Long.


      Is there some configuration wrong?


      Hopefully someone knows the answer (I am overlooking).


      Thanks!
      Coen

        • 1. Re: Hibernate mappings not picked up by Seam-gen
          Arbi Sookazian Master

          seam-gen uses hbm2java to revengr your entities.  so this should be posted on Hibernate forum or possibly JBoss Tools Users forum if you're not using cmd line.

          • 2. Re: Hibernate mappings not picked up by Seam-gen
            Coen Damen Novice

            Ok I found a solution.


            The problem is that Eclipse Jboss Tools - new - generate Seam entities generates the entities, the Home/List and JSF crud pages. That's a cool feature and maybe I expected too much from it, no offence.
            The problem is that this feature does not pick up the reveng.xml file. It generates nice default Entity Beans and the rest.


            The solution is: goto  Eclipe - Run - Hibernate Code Generation - Hibernate Code Generation Configurations and there you can define the reveng.xml file/location.
            Then you need to run the Entity generation AGAIN, and now it's ok.


            I assumed that this would be handled nicely by the generate Seam entities target if I'd put the reveng.xml in the src/main/resources folder. But it didn't. When using generate entities from a JPA enabled Eclipse project, that works fine, so that was the mixup.


            Maybe this feature can be added by the Jboss Tools development team later on :) Would save a lot of time !


            Cheers,
            Coenos