r2dbc

Log values of query parameters in Spring Data R2DBC?

廉价感情. 提交于 2021-02-20 16:15:25
问题 In Spring Data R2DBC I can log SQL queries by using logging.level.org.springframework.data.r2dbc=DEBUG in the application.properties . However, this doesn't log the actual values that are bound as query parameters. How can I log the actual values of query parameters in Spring Data R2DBC? 回答1: This worked for me : logging: level: io.r2dbc.postgresql.QUERY: DEBUG # for queries io.r2dbc.postgresql.PARAM: DEBUG # for parameters I found it here 回答2: If you happen to use MySQL, you can get a low

Connection-reuse and transactions (relationship)

↘锁芯ラ 提交于 2021-01-28 05:00:24
问题 How does R2DBC implement transaction-handling. As far as I know, JDBC use one connection for one transaction. So in Spring MVC we have the following mapping: 1 request : 1 thread : 1 transaction : 1 connection. What is the mapping in Webflux with R2DBC? Webflux is reactive, so when we open one transaction, does it use one connection until the end of the transaction? If so, then a transaction is something like a blocking operation because, while the transaction is active no other transaction

How to execute multiple inserts in batch in r2dbc?

孤街浪徒 提交于 2020-12-15 05:44:17
问题 I need to insert multiple rows into one table in one batch. In DatabaseClient i found insert() statement and using(Publisher objectToInsert) method which has multiple objects as argument. But would it insert them in one batch or not? Another possible solution is connection.createBatch(), but it has a drowback : I cannot pass my Entity object there and i cannot generate sql query from the entity. So, is it possible to create batch insert in r2dbc? 回答1: There are two questions: Would

How to execute multiple inserts in batch in r2dbc?

笑着哭i 提交于 2020-12-15 05:43:41
问题 I need to insert multiple rows into one table in one batch. In DatabaseClient i found insert() statement and using(Publisher objectToInsert) method which has multiple objects as argument. But would it insert them in one batch or not? Another possible solution is connection.createBatch(), but it has a drowback : I cannot pass my Entity object there and i cannot generate sql query from the entity. So, is it possible to create batch insert in r2dbc? 回答1: There are two questions: Would

Connection pool size with postgres r2dbc-pool

与世无争的帅哥 提交于 2020-07-09 09:35:35
问题 I'm not able to open more than 10 connections with spring-webflux and r2dbc (with r2dbc-pool driver 0.8.0.M8 ). My config looks like: @Configuration public class PostgresConfig extends AbstractR2dbcConfiguration { @Override @Bean public ConnectionFactory connectionFactory() { ConnectionFactory connectionFactory = ConnectionFactories.get(ConnectionFactoryOptions.builder() .option(DRIVER, "pool") .option(PROTOCOL, "postgresql") .option(HOST, host) .option(USER, user) .option(PASSWORD, password)

Connection pool size with postgres r2dbc-pool

早过忘川 提交于 2020-07-09 09:33:21
问题 I'm not able to open more than 10 connections with spring-webflux and r2dbc (with r2dbc-pool driver 0.8.0.M8 ). My config looks like: @Configuration public class PostgresConfig extends AbstractR2dbcConfiguration { @Override @Bean public ConnectionFactory connectionFactory() { ConnectionFactory connectionFactory = ConnectionFactories.get(ConnectionFactoryOptions.builder() .option(DRIVER, "pool") .option(PROTOCOL, "postgresql") .option(HOST, host) .option(USER, user) .option(PASSWORD, password)

R2DBC and enum (PostgreSQL)

穿精又带淫゛_ 提交于 2020-06-01 12:32:27
问题 Does H2DBC support PostgreSQL enums? I checked they git page but it doesn't mention anything about it. If it does, how enums could be used (INSERT, SELECT)? Lets say PostgreSQL enum CREATE TYPE mood AS ENUM ('UNKNOWN', 'HAPPY', 'SAD', ...); Java class @Data public class Person { private String name; private Mood mood; // ... enum Mood{ UNKNOWN, HAPPY, SAD, ...} } I tried: // insert var person = ...; client.insert() .table("people") .using(person) .then() .subscribe(System.out::println); //

R2DBC and enum (PostgreSQL)

旧时模样 提交于 2020-06-01 12:32:06
问题 Does H2DBC support PostgreSQL enums? I checked they git page but it doesn't mention anything about it. If it does, how enums could be used (INSERT, SELECT)? Lets say PostgreSQL enum CREATE TYPE mood AS ENUM ('UNKNOWN', 'HAPPY', 'SAD', ...); Java class @Data public class Person { private String name; private Mood mood; // ... enum Mood{ UNKNOWN, HAPPY, SAD, ...} } I tried: // insert var person = ...; client.insert() .table("people") .using(person) .then() .subscribe(System.out::println); //

How to join tables in r2dbc?

◇◆丶佛笑我妖孽 提交于 2020-05-15 08:47:05
问题 In java reactor, r2dbc. I have two tables A, B. I also have repositories for them defined. How can i get data made up of A join B? I only come up with the following approach: call databaseClient.select from A and consequently in a loop call select from B. But i want more efficient and reactive way. How to do it? 回答1: TL;DR: Using SQL. Spring Data's DatabaseClient is an improved and reactive variant for R2DBC of what JdbcTemplate is for JDBC. It encapsulates various execution modes, resource