I've implemented a custom SequenceGenerator
that I want to use in all my entities for the "id". But rather than having to do something like this for each entity:
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "XyzIdGenerator")
@GenericGenerator(name = "XyzIdGenerator",
strategy = "com.mycompany.myapp.id.BigIntegerSequenceGenerator",
parameters = {
@Parameter(name = "sequence", value = "xyz_id_sequence")
})
public BigInteger getId()
{
return id;
}
is there a way to apply this SequenceGenerator
to ALL entities by default using vanilla Hibernate/JPA or perhaps by using Spring?