0 Replies Latest reply on Jun 26, 2014 7:28 PM by n3k0

    Forge2 generating JPA entities does not respect the hibernate.revenge.xml file.

    n3k0

      Hi.

      I have a (probably stupid) mistake with the forge 2 create entities from tables utility.

      First, i run this command:

       

      [myProject]$ jpa-generate-entities-from-tables --jdbcUrl jdbc:oracle:thin:myhost:1521:myDataBase
      --userName myUsername --userPassword ***** --driverLocation C:\the\path\of\lib\ojdbc6-11.2.0.3.jar
      
      

       

      So, after that, in the console appears the options of what dialect i want to use (i prefer this way, because a NEVER remember the correct name) something like this:

       

      [0] - MySQL5 : org.hibernate.dialect.MySQL5Dialect
      [1] - MySQL5 with InnoDB : org.hibernate.dialect.MySQL5InnoDBDialect
      [2] - MySQL with MyISAM : org.hibernate.dialect.MySQLMyISAMDialect
      [3] - Oracle (any version) : org.hibernate.dialect.OracleDialect
      [4] - Oracle 9i : org.hibernate.dialect.Oracle9iDialect
      [5] - Oracle 10g : org.hibernate.dialect.Oracle10gDialect
      [6] - Oracle 11g : org.hibernate.dialect.Oracle10gDialect
      [7] - DB2 : org.hibernate.dialect.DB2Dialect
      [8] - DB2 AS/400 : org.hibernate.dialect.DB2400Dialect
      [9] - DB2 OS390 : org.hibernate.dialect.DB2390Dialect
      [10] - PostgreSQL : org.hibernate.dialect.PostgreSQLDialect
      [11] - Microsoft SQL Server 2000 : org.hibernate.dialect.SQLServerDialect
      [12] - Microsoft SQL Server 2005 : org.hibernate.dialect.SQLServer2005Dialect
      [13] - Microsoft SQL Server 2008 : org.hibernate.dialect.SQLServer2008Dialect
      [14] - SAP DB : org.hibernate.dialect.SAPDBDialect
      [15] - Informix : org.hibernate.dialect.InformixDialect
      [16] - HypersonicSQL : org.hibernate.dialect.HSQLDialect
      [17] - H2 Database : org.hibernate.dialect.H2Dialect
      [18] - Ingres : org.hibernate.dialect.IngresDialect
      [19] - Progress : org.hibernate.dialect.ProgressDialect
      [20] - Mckoi SQL : org.hibernate.dialect.MckoiDialect
      [21] - Interbase : org.hibernate.dialect.InterbaseDialect
      [22] - Pointbase : org.hibernate.dialect.PointbaseDialect
      [23] - FrontBase : org.hibernate.dialect.FrontbaseDialect
      [24] - Firebird : org.hibernate.dialect.FirebirdDialect
      [25] - Sybase : org.hibernate.dialect.SybaseASE15Dialect
      [26] - Sybase Anywhere : org.hibernate.dialect.SybaseAnywhereDialect
      
      Hibernate Dialect (The Hibernate dialect to use): [0-26] 6
      
      Hibernate Dialect (The Hibernate dialect to use): [0-26] 6
      
      

       

      Ok, everything seems correct; BUT when i proceed to execute the command, forge begins to make the files that represents the classes, suddenly, the next error appears:

       

      org.hibernate.cfg.JDBCBinderException: Duplicate class name 'org.hibernateTesting.model.NrcAdopcion' generated for 'org.hibernate.mapping.Table(PREFIX.TABLE)'. Same name where generated for 'org.hibernate.mapping.Table(PREFIX.TABLE)'

       

      For some reasons that aren't important here i have duplicate table names in different schemas and the database user can see all schemas, so i read about that error, and it suppose

      that the hibernate.revenge.xml file can handle that situations. So i wrote the file, and is very small:

       

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE hibernate-reverse-engineering
        SYSTEM "http://hibernate.sourceforge.net/hibernate-reverse-engineering.dtd" >
      
      <hibernate-reverse-engineering>
          <table-filter match-name="PREFIX.*" exclude="true" />
      </hibernate-reverse-engineering>
      
      
      
      

       

      I put the file here:

       

      myProject

         |

        src

         |_main

         |    |_java

         |    |_resources

         |    |        |_hibernate.revenge.xml     <---HERE!

         |    |_webapp

         |

         |_test

       

      And well, my question is .... if i have to put the file in other place. I know it looks like the question is for hibernate forum, but i don't know if forge is using hibernate utilities in some way.

       

      Thanks in advance.