Davide D'Alto (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) *created* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiMTFlYzMzOTJh...
) / Bug (
https://hibernate.atlassian.net/browse/HHH-16365?atlOrigin=eyJpIjoiMTFlYz...
) HHH-16365 (
https://hibernate.atlassian.net/browse/HHH-16365?atlOrigin=eyJpIjoiMTFlYz...
) Wrong insert identity query generated when disabling use_get_generated_keys with Sql
Server (
https://hibernate.atlassian.net/browse/HHH-16365?atlOrigin=eyJpIjoiMTFlYz...
)
Issue Type: Bug Assignee: Unassigned Created: 24/Mar/2023 03:44 AM Priority: Major
Reporter: Davide D'Alto (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
)
Entity example:
@Entity(name = "Flour" )
@Table(name = "Flour" )
public static class Flour {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
...
}
and setting
hibernate.jdbc.use_get_generated_keys = false
It will produce the following invalid query with Sql Server:
insert into Flour (description, name , type ) values (?,?,?) returning id
instead of ( ORM 5.6.14)
insert into Flour (description, name , type ) values (?, ?, ?) select scope_identity()
or
insert into Flour (description, name , type ) output inserted.id values (?, ?, ?)
(
https://hibernate.atlassian.net/browse/HHH-16365#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-16365#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#100219- sha1:ac3e918 )