I'm trying to create a @GenericGenerator annotation at the package level so it can be used by all the entities in the package.
1) I have a package-info.java class with the annotation:
@org.hibernate.annotations.GenericGenerator(name = "ID_GENERATOR", strategy = "enhanced-sequence", parameters = {
@org.hibernate.annotations.Parameter(name = "sequence_name", value = "JPWH_SEQUENCE"),
@org.hibernate.annotations.Parameter(name = "initial_value", value = "1000") })
package com;
2) In that same package, I have an entity with the following attribute:
@Id
@GeneratedValue(generator = "ID_GENERATOR")
private Long id;
this is resulting in an exception "Unknown Id.generator: ID_GENERATOR". If I include the @GenericGenerator annotation in the entity class, it works fine. However, I want to move this to the package level so I can reuse it in other entities.
Any ideas where the disconnect could be?
Thanks!