When you use
@GeneratedValue(strategy=GenerationType.AUTO)
or
@GeneratedValue
which is short hand way of the above, Hibernate starts to decide the best
generation strategy for you, in this case it has selected
GenerationType.SEQUENCE
as the strategy and that is why it is looking for
schemaName.hibernate_sequence
which is a table, for sequence based id generation.
When you use GenerationType.SEQUENCE
as the strategy you need to provide the @TableGenerator
as follows.
@Id
@GeneratedValue(strategy = GenerationType.TABLE, generator = "user_table_generator")
@TableGenerator(name = "user_table_generator",
table = "user_keys", pkColumnName = "PK_NAME", valueColumnName = "PK_VALUE")
@Column(name = "USER_ID")
private long userId;
When you set the strategy it the to
@GeneratedValue(strategy = GenerationType.IDENTITY)
.
original issue get resolved because then Hibernate stop looking for sequence table.