Hello, I have a one small question I am using Spi...
# server
j
Hello, I have a one small question I am using Sping - Kotlin gradle:
Copy code
implementation("org.springframework.boot:spring-boot-starter-data-r2dbc")
	implementation("io.r2dbc:r2dbc-h2")
	runtimeOnly("org.postgresql:postgresql")
	runtimeOnly("org.postgresql:r2dbc-postgresql")
My repository is:
Copy code
@Repository
interface UserRepository: CoroutineCrudRepository<User, String>
User class:
Copy code
@Table("app_user")
data class User(
    @Id
    @Column("EMAIL")
    val email: String,
    @Column("COMPANY_ID")
    val companyId: Long?,
    @Column("PASSWORD")
    val password: String? = null,
    @Column("ROLE")
    val role: String?
    )
And when I call
Copy code
userRepository.findById(email)
I receive:
Copy code
[o-auto-1-exec-2] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed: org.springframework.r2dbc.BadSqlGrammarException: executeMany; bad SQL grammar [SELECT app_user.* FROM app_user WHERE app_user.EMAIL = $1 LIMIT 2]] with root cause

io.r2dbc.postgresql.ExceptionFactory$PostgresqlBadGrammarException: column app_user.email does not exist
	at io.r2dbc.postgresql.ExceptionFactory.createException(ExceptionFactory.java:96) ~[r2dbc-postgresql-1.0.5.RELEASE.jar:1.0.5.RELEASE]
	at io.r2dbc.postgresql.ExceptionFactory.createException(ExceptionFactory.java:65) ~[r2dbc-postgresql-1.0.5.RELEASE.jar:1.0.5.RELEASE]
	at io.r2dbc.postgresql.ExceptionFactory.handleErrorResponse(ExceptionFactory.java:132) ~[r2dbc-postgresql-1.0.5.RELEASE.jar:1.0.5.RELEASE]
	at reactor.core.publisher.FluxHandleFuseable$HandleFuseableSubscriber.onNext(FluxHandleFuseable.java:179) ~[reactor-core-3.6.10.jar:3.6.10]
...
sorry for stupid question probably but I dont see anything bad in a code or logs 😕 1. what is wrong with my code? 😄 2. Why it ask
WHERE app_user.EMAIL =
and not only
WHERE EMAIL =
? 3. Is there some a good way ho read a logs ( crashes ) and find what happen? Because I think little bit a problem can be somewhere else 😕 Thank you for any help, suggestion! A Scheme and tables was created from Spring so connection should be okay but here is my
application.yaml
Copy code
spring:
  application:
    name: voyager
  jpa:
    defer-datasource-initialization: true
  sql:
    init:
      mode: always
  r2dbc:
    url: r2dbc:<postgresql://localhost:5432/>
    username: voyager
    password: voyager
    schema: voyager
not kotlin but kotlin colored 2
👍 1
j
This is not kotlin-related, next time you should ask your question to another community. Try writing
"app_user.EMAIL"
instead of
app_user.EMAIL
Postgres is case-insensitive by default.
j
Sorry, I take it little bit like kotlin/spring, I dont write this SQL, it is generated from
CoroutineCrudRepository
j
Oh, you’re wright, I read a bit too fast. My bad :)