all. I have a problem with generating a DB schema via hbm2ddl. I want to use a common sequence generator for all private keys. Therefore, 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 identifiers.
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 the 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 this a problem, or am I doing something wrong?
source
share