# Schema-validation: missing table for an auto-sequence id

**URL:** <https://discourse.hibernate.org/t/schema-validation-missing-table-for-an-auto-sequence-id/10090>\
**Category:** Hibernate ORM\
**Created:** [August 7, 2024, 6:44pm UTC](https://discourse.hibernate.org/t/schema-validation-missing-table-for-an-auto-sequence-id/10090 "2024-08-07T18:44:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![saurabh](https://avatars.discourse-cdn.com/v4/letter/s/ee7513/32.png) [@saurabh](https://discourse.hibernate.org/u/saurabh)\
**Post date:** [August 7, 2024, 6:44pm UTC](https://discourse.hibernate.org/t/schema-validation-missing-table-for-an-auto-sequence-id/10090/1 "2024-08-07T18:44:35Z")

</div>

While migrating hibernate-core from `5.6.10` to `6.1.7` and hibernate-validator to `8.0.0-Final` I am getting missing table errors (on my entities auto increment ids) even though the table exists.

For some of my entities I can resolve this by using `@GeneratedValue(strategy=GenerationType.IDENTITY)` on the Id.

However, for some entities that inherit from a superclass and can’t be modified I’m stuck with this error.

```auto
Caused by: org.hibernate.tool.schema.spi.SchemaManagementException: Schema-validation: missing table [`user_rev_entity_seq`]
		at org.hibernate.tool.schema.internal.AbstractSchemaValidator.validateTable(AbstractSchemaValidator.java:133)
		at org.hibernate.tool.schema.internal.GroupedSchemaValidatorImpl.validateTables(GroupedSchemaValidatorImpl.java:46)
		at org.hibernate.tool.schema.internal.AbstractSchemaValidator.performValidation(AbstractSchemaValidator.java:96)
		at org.hibernate.tool.schema.internal.AbstractSchemaValidator.doValidation(AbstractSchemaValidator.java:74)
		at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:293)
		at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.lambda$process$5(SchemaManagementToolCoordinator.java:143)
		at java.base/java.util.HashMap.forEach(HashMap.java:1421)
		at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:140)
		at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:336)
		at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:415)
		at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1423)
		at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:75)
		at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:376)
		at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:409)
	

```

Example below:

My class below `UserRevEntity` implements the interface `DefaultRevisionEntity` which has the @GeneratedValue id that I can’t modify to add the strategy.

```auto
@Entity
@RevisionEntity(UserRevisionListener.class)
public class UserRevEntity extends DefaultRevisionEntity {
    private Integer userId;

```

```auto
@MappedSuperclass
public class DefaultRevisionEntity implements Serializable {
    private static final long serialVersionUID = 8530213963961662300L;
    @Id
    @GeneratedValue
    @RevisionNumber
    private int id;

```

How should I fix this?

---

<div class="post-metadata">

**Author:** ![mbladel](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/mbladel/32/2128_2.png) [@mbladel](https://discourse.hibernate.org/u/mbladel)\
**Post date:** [August 13, 2024, 8:05am UTC](https://discourse.hibernate.org/t/schema-validation-missing-table-for-an-auto-sequence-id/10090/2 "2024-08-13T08:05:14Z")

</div>

In Hibernate 6 the way we determine implicit names for `@GeneratedValue` sequences and tables has changed, see [this chapter](https://docs.jboss.org/hibernate/orm/6.0/migration-guide/migration-guide.html#id-sequence-table-name) of the migration guide for more details. TLDR: Hibernate by default creates a sequence per entity hierarchy instead of a single sequence `hibernate_sequence` - that’s probably why you’re seeing this error now.

We suggest assuring you have all the correct sequences setup correctly, but as a workaround you can always go back to the previous behavior by specifying the naming strategy `org.hibernate.id.enhanced.ImplicitDatabaseObjectNamingStrategy` using the `hibernate.id.db_structure_naming_strategy` configuration property.
