8 Replies Latest reply on Oct 1, 2016 2:59 PM by ymazar

    TableGenerator is not backward compatible when upgrading from JBoss 4.2.3 to Wildfly 9.0.1

    ymazar

      I am trying to upgrade an EJB project that we have from JBoss 4.2.3 to Wildfly 9.0.1

       

      All our entities are inheriting from a supper class named RootEntity which has the Id property as you can see below:

       

      @Id

        @Column(name = COLUMN_ID)

        @GeneratedValue(strategy = GenerationType.TABLE, generator = GENERATOR)

        @TableGenerator(name = GENERATOR, table = GENERATED_IDS_TABLE_NAME, schema = "Common")

        protected long id;

       

      This setting works fine on 4.2.3 (Hibernate creates a row for each entity type in the Id generation table), but when I upgraded to 9.0.1 I got "cannot read or init hi value".

      I have spent few days trying to work around this issue - I tried to create a persistence.xml file with the following property

       

      <property name="hibernate.id.new_generator_mappings" value="false"></property>

       

      as mentioned in this thread, but this didn't help - I got an "unknown error" and I wasn't able to get this working. I even tried to specify the names of the key and value columns in the @TableGenerator attribute but It still didn't solve the issue

       

      I am trying to come up with an elegant solution that will allow me to do the migration without significant code/db schema changes (While maintaining backward compatibility) and I would appreciate any advice you can give me on this.

       

      Thanks,

       

      Yoni