diff --git a/orm/callback_create.go b/orm/callback_create.go index b80abe3..42dce66 100644 --- a/orm/callback_create.go +++ b/orm/callback_create.go @@ -119,7 +119,7 @@ func createCallback(scope *Scope) { } else { if scope.Dialect().GetName() == "h2" { - _, err := scope.SQLDB().Exec(scope.SQL, scope.SQLVars...) + _, err := scope.SQLDB().Query(scope.SQL, scope.SQLVars...) if scope.Err(err) == nil { primaryField.IsBlank = false scope.db.RowsAffected = 1 diff --git a/orm/dialect_h2.go b/orm/dialect_h2.go index 0f14f8b..75218ad 100644 --- a/orm/dialect_h2.go +++ b/orm/dialect_h2.go @@ -114,7 +114,7 @@ func (s h2) CurrentDatabase() (name string) { func (s h2) LastInsertIDReturningSuffix(tableName, key string) string { //return fmt.Sprintf("RETURNING %v.%v", tableName, key) - return fmt.Sprintf(" ; ") + return fmt.Sprintf(" ; CALL IDENTITY(); ") } func (h2) SupportLastInsertID() bool {