Add support for SQL Server's INSERT … OUTPUT
clause
#577
Labels
type: enhancement
A general enhancement
INSERT … OUTPUT
clause
#577
Current setup
dependencies
spring boot v 2.4.3
<dependency> <groupId>org.springframework.data</groupId> <artifactId>spring-data-r2dbc</artifactId> </dependency> <dependency> <groupId>io.r2dbc</groupId> <artifactId>r2dbc-mssql</artifactId> </dependency> <dependency> <groupId>io.r2dbc</groupId> <artifactId>r2dbc-pool</artifactId> </dependency>
Repository
ItemRepository extends ReactiveCrudRepository<Item, UUID>
DB schema in mssql server
[id] UNIQUEIDENTIFIER default NEWID(),
...
code
var itemToSave = new Item().setName(); RegistrationRoute newSavedEntity = itemRepo.save(itemToSave) .log() .block();
The entity is the same instance and the id is not populated.
Notes:
The above works as expected when running on H2 data base. Although the instance is mutated as opposed a brand new one to be created which I would expect.
The type of the id has the same behaviour declared either UUID or String. Which is as expected since the mapping between DB type and Java type comes from the mssql r2dbc driver which supports UUID/String -> uniqueIdentifier
Trying the varchar() (with auto generated GUID) -> String mapping for key. Still doesn't work
Trying the INT (with IDENTITY => autogenerate sequence)-> Integer/int mapping for key it does work as expected
The text was updated successfully, but these errors were encountered: