Spring Boot project fails to run because of Schema-validation: missing sequence [hibernate_sequence]

You are facing the issue as there is a missing sequence hibernate_sequence. You can create the sequence manually on your DB using create sequence <schema>.hibernate_sequence. For more info about creating a sequence in Derby please follow the link.


Hit this issue and below is my searching results:

  1. If you use GenerationType.AUTO in your java bean, then by default hibernate uses hibernate_sequence for the sequence.

    So one option is to create this sequence in the DB by:

    create sequence <schema>.hibernate_sequence

  2. or you can use @GeneratedValue(strategy = GenerationType.IDENTITY) instead in your java bean source code, which does not require such sequence.

    Quoting Java Persistence/Identity:

    Identity sequencing uses special IDENTITY columns in the database to allow the database to automatically assign an id to the object when its row is inserted. Identity columns are supported in many databases, such as MySQL, DB2, SQL Server, Sybase and Postgres. Oracle does not support IDENTITY columns but they can be simulated through using sequence objects and triggers.

Further reading:

GenerationType.AUTO vs GenerationType.IDENTITY in hibernate