I have kotlin & Micronaut application connecting to postgresql using r2dbc
for reactive approach
r2dbc:
datasources:
default:
schema-generate: NONE
dialect: POSTGRES
url: r2dbc:postgresql://localhost:5434/mydb
username: postgres
password: postgres
I have the table called Customer inside database mydb
and schema myschema
, but while using the @MappedEntity we can only define the table name. Since table is inside of myschema
the application is throws entity does not exist
15:26:15.455 [reactor-tcp-nio-1] ERROR i.m.h.n.stream.HttpStreamsHandler - Error occurred writing stream response: relation "customer" does not exist io.r2dbc.postgresql.ExceptionFactory$PostgresqlBadGrammarException: relation "customer" does not exist
how to define schema name in MappedEntity
annotation ?
One way you can do it is, you can define the current schema in url using query parameter
url: r2dbc:postgresql://localhost:5434/mydb?currentSchema=myschema