java.sql.SQLSyntaxErrorException: Table 'Database.hibernate_sequences' doesn't exist

I am getting below error:
[ERROR] 2021-07-13 12:21:23.164 TableGenerator - HHH000351: Could not read or init a hi value
java.sql.SQLSyntaxErrorException: Table ‘database.hibernate_sequences’ doesn’t exist
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120) ~[mysql-connector-java-8.0.25.jar:8.0.25]
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122) ~[mysql-connector-java-8.0.25.jar:8.0.25]
at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:953) ~[mysql-connector-java-8.0.25.jar:8.0.25]
at com.mysql.cj.jdbc.ClientPreparedStatement.executeQuery(ClientPreparedStatement.java:1003) ~[mysql-connector-java-8.0.25.jar:8.0.25]
at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:431) ~[c3p0-0.9.5.4.jar:0.9.5.4]
at org.hibernate.id.enhanced.TableGenerator.executeQuery(TableGenerator.java:705) ~[hibernate-core-5.4.30.Final.jar:5.4.30.Final]
at org.hibernate.id.enhanced.TableGenerator.access$400(TableGenerator.java:132) ~[hibernate-core-5.4.30.Final.jar:5.4.30.Final]
at org.hibernate.id.enhanced.TableGenerator$1$1.execute(TableGenerator.java:589) ~[hibernate-core-5.4.30.Final.jar:5.4.30.Final]
at org.hibernate.id.enhanced.TableGenerator$1$1.execute(TableGenerator.java:575) ~[hibernate-core-5.4.30.Final.jar:5.4.30.Final]
at org.hibernate.jdbc.WorkExecutor.executeReturningWork(WorkExecutor.java:55) ~[hibernate-core-5.4.30.Final.jar:5.4.30.Final]
at org.hibernate.jdbc.AbstractReturningWork.accept(AbstractReturningWork.java:34) ~[hibernate-core-5.4.30.Final.jar:5.4.30.Final]
at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcIsolationDelegate.delegateWork(JdbcIsolationDelegate.java:57) ~[hibernate-core-5.4.30.Final.jar:5.4.30.Final]
at org.hibernate.id.enhanced.TableGenerator$1.getNextValue(TableGenerator.java:574) ~[hibernate-core-5.4.30.Final.jar:5.4.30.Final]
at org.hibernate.id.enhanced.NoopOptimizer.generate(NoopOptimizer.java:40) ~[hibernate-core-5.4.30.Final.jar:5.4.30.Final]
at org.hibernate.id.enhanced.TableGenerator.generate(TableGenerator.java:570) ~[hibernate-core-5.4.30.Final.jar:5.4.30.Final]
at org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:115) ~[hibernate-core-5.4.30.Final.jar:5.4.30.Final]
at org.hibernate.event.internal.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:185) ~[hibernate-core-5.4.30.Final.jar:5.4.30.Final]
at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:128) ~[hibernate-core-5.4.30.Final.jar:5.4.30.Final]
at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:55) ~[hibernate-core-5.4.30.Final.jar:5.4.30.Final]
at org.hibernate.event.service.internal.EventListenerGroupImpl.fireEventOnEachListener(EventListenerGroupImpl.java:93) [hibernate-core-5.4.30.Final.jar:5.4.30.Final]
at org.hibernate.internal.SessionImpl.firePersist(SessionImpl.java:720) [hibernate-core-5.4.30.Final.jar:5.4.30.Final]
at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:706) [hibernate-core-5.4.30.Final.jar:5.4.30.Final]

I am using Inheritance type TABLE_PER_CLASS and tried Generate value AUTO, TABLE, IDENTITY, SEQUENCE but same error.

[ERROR] 2021-07-13 12:21:23.164 TableGenerator - HHH000351: Could not read or init a hi value

Please find entity.

The error is telling you that the table to implement sequence based id generation is missing. What is it that you don’t understand there? If you are not using the hbm2ddl tool to automatically generate these tables, you will have to create this table manually in your database. Then your application will also startup properly.