SQL Server 2016 - Invalid object name 'hibernate_sequence'
It seems you are upgrading SqlServer version. I faced it when i was upgrading SqlServer 2012 to SqlSever 2017.
Caused by : talk between driver (jtds or sqlserver ) and SqlServer 2017+ no more consider table "dbo.hibernate_sequence" as work-around. It needs specifically sequence with name hibernate_sequence.
solution : delete table named as dbo.hibernate_sequence and create sequence
Example :
USE [your_database_name]
GO
CREATE SEQUENCE [dbo].[hibernate_sequence]
AS [bigint]
START WITH 10000000
INCREMENT BY 1
MINVALUE -9223372036854775808
MAXVALUE 9223372036854775807
CACHE
GO
SqlServer Studio screenshot
Following points to check:
- What dialect you are using?
- What hibernate version you are using? Version 5 changed the GenerationType.AUTO behavior
- Set
"hibernate.hbm2ddl.auto"
toupdate
and see what it creates in the database - Avoid
GenerationType.AUTO
. Set it explicit toGenerationType.IDENTITY
orGenerationType.SEQUENCE
depending on what you want or your DB supports. - Check if you have the latest SQL Server JDBC driver. I had issues with it migrating from hibertnate 4.3 to 5.0
- In hibernate 5 set
hibernate.id.new_generator_mappings
to false