Koen Konst (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) *created* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiYjU0ZTc2YWM0...
) / Bug (
https://hibernate.atlassian.net/browse/HHH-15561?atlOrigin=eyJpIjoiYjU0ZT...
) HHH-15561 (
https://hibernate.atlassian.net/browse/HHH-15561?atlOrigin=eyJpIjoiYjU0ZT...
) Function "IDENTITY" not found when inserting audited revision using Hibernate
Envers (
https://hibernate.atlassian.net/browse/HHH-15561?atlOrigin=eyJpIjoiYjU0ZT...
)
Issue Type: Bug Affects Versions: 5.6.10 Assignee: Unassigned Created: 30/Sep/2022 06:07
AM Priority: Major Reporter: Koen Konst (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
)
When inserting an audited revision I get the following error:
Hibernate: insert into audited_revision (id, timestamp) values (default, ?)
2022-07-21 15:46:09.496 TRACE 67111 --- [ XNIO-1 task-1]
o.h.type.descriptor.sql.BasicBinder : binding parameter [1] as [TIMESTAMP] - [Thu Jul
21 15:46:09 CEST 2022]
Hibernate: call identity()
2022-07-21 15:46:09.504 WARN 67111 --- [ XNIO-1 task-1]
o.h.engine.jdbc.spi.SqlExceptionHelper : SQL Error: 90022, SQLState: 90022
2022-07-21 15:46:09.504 ERROR 67111 --- [ XNIO-1 task-1]
o.h.engine.jdbc.spi.SqlExceptionHelper : Function "IDENTITY" not found; SQL
statement:
call identity() [90022-214]
2022-07-21 15:46:09.518 ERROR 67111 --- [ XNIO-1 task-1]
o.z.problem.spring.common.AdviceTraits : Internal Server Error
org.springframework.dao.InvalidDataAccessResourceUsageException: could not prepare
statement; SQL [call identity()]; nested exception is
org.hibernate.exception.SQLGrammarException: could not prepare statement
This error occurs with Hibernate Envers version 5.6.10 and H2 version 2.1.214. This blocks
us from upgrading Spring Boot from 2.6 to 2.7. It seems to be related to
https://hibernate.atlassian.net/browse/HHH-14985 (
https://hibernate.atlassian.net/browse/HHH-14985 ).
The table has successfully been created on startup of the integration test.
Hibernate: create table audited_revision (id bigint generated by default as identity,
timestamp timestamp, primary key (id))
My application.yml has the following configuration:
spring:
jpa:
defer-datasource-initialization: true
database: H2
hibernate:
ddl-auto: create-drop
open-in-view: false
properties:
format_sql: true
org:
hibernate:
envers:
store_data_at_delete: true
hibernate:
temp:
use_jdbc_metadata_defaults: false
dialect: org.hibernate.dialect.H2Dialect
show-sql: true
It seems that the new H2 dialect from version 2.X isn’t fully supported by Hibernate.
(
https://hibernate.atlassian.net/browse/HHH-15561#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-15561#add-comment?atlOrigin=ey...
)
Get Jira notifications on your phone! Download the Jira Cloud app for Android (
https://play.google.com/store/apps/details?id=com.atlassian.android.jira....
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100207- sha1:ee9e30a )