I'm trying to use a sequence table to generate keys for my entities. I notice that if I just use the @GeneratedValue(strategy=GenerationType.TABLE) with no explicit generator, Hibernate will automatically create the hibernate_sequences table in my DB if it doesn't exist. This is great. However, I wanted to make some changes to the sequence table, so I created a @TableGenerator like the following:
@GeneratedValue(strategy=GenerationType.TABLE, generator="vdat_seq")
@TableGenerator(name="vdat_seq", table="VDAT_SEQ", pkColumnName="seq_name",
valueColumnName="seq_next_val", allocationSize=1)
This works fine if I manually create the VDAT_SEQ table in my schema; Hibernate won't auto-create it anymore. This causes an issue in my unit tests, since I'd rather not have to manually create a table and maintain it on our testing DB.
Is there a configuration variable or some other way to get Hibernate to generate the sequence table?