all. I have an issue with DB scheme generation via hbm2ddl. I want to use shared sequence generator for all private keys. So I defined it once in some entity.
@Entity
@SequenceGenerator(name = "MY_SEQUENCE_GENERATOR", sequenceName = "MY_SEQ")
public class MyEntity implements Serializable {
....
}
Then I want to use this sequence generator for all ids.
public class SomeEntity1 implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "MY_SEQUENCE_GENERATOR")
Long id;
....
}
public class SomeEntity2 implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "MY_SEQUENCE_GENERATOR")
Long id;
....
}
When I run hbm2ddl ant task I get an exception:
[hibernatetool] javax.persistence.PersistenceException: org.hibernate.AnnotationException: Unknown Id.generator: MY_SEQUENCE_GENERATOR
[hibernatetool] org.hibernate.AnnotationException: Unknown Id.generator: MY_SEQUENCE_GENERATOR
Is it an issue or I'm doing something wrong ?