The Thirteenth bug-fix release for Hibernate ORM 5.2 has just been published.

Details

  • tag is here;

  • changes are listed here (or, for people without a Hibernate Jira account, here);

  • release bundles are at SourceForge.

For information on consuming the release via your favorite dependency-management-capable build tool, see releases

Changes in the @TableGenerator and @SequenceGenerator name scope

In order to be compliant with the JPA specifications, the names of identity generators need now be considered global, and no longer scoped to the entity in which they are declared. This means existing applications might now have a naming conflict which needs to be addressed to upgrade. Configuring two generators, even with different types but with the same name will now cause a java.lang.IllegalArgumentException to be thrown at boot time.

For example, the following mappings are no longer valid:

@Entity
@TableGenerator(name = "ID_GENERATOR", ... )
public class FirstEntity {
    ....
}

@Entity
@TableGenerator(name = "ID_GENERATOR", ... )
public class SecondEntity {
    ....
}

or

@Entity
@TableGenerator(name = "ID_GENERATOR", ... )
public class FirstEntity {
    ....
}

@Entity
@SequenceGenerator(name="ID_GENERATOR", ... )
public class SecondEntity {
    ....
}

to avoid the name collision between the two id generators, the name of one of them needs to be changed.


Back to top