I'm currently building a REST API using Kotlin/SpringBoot. As a database, I opted for PostgreSQL. When I run the application, I can create a new User (using Postman). However, when I try to perform the same action in my tests, I receive the following error:
org.postgresql.util.PSQLException: ERROR: column "uuid" is of type bytea but expression is of type uuid
The thing is I don't know how/where my column is interpreted as bytea. I did set up uuid as the datatype in my sql migration.
Here's my sql:
CREATE TABLE IF NOT EXISTS users (
id BIGINT auto_increment,
uuid UUID NOT NULL,
name TEXT,
password TEXT,
created_at TIMESTAMP,
updated_at TIMESTAMP,
PRIMARY KEY (id)
);
Here's the Entity:
@Entity
@Table(name = "users")
data class UserEntity(
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
val id: Long,
@Column(name = "uuid", unique = true, updatable = false, columnDefinition = "uuid")
val uuid: UUID,
val name: String,
val password: String,
@Column(name="created_at")
val createdAt: LocalDateTime,
@Column(name="updated_at")
val updatedAt: LocalDateTime
)
And here's the application.properties at my test level:
spring.jpa.database=POSTGRESQL
spring.datasource.platform=postgres
spring.datasource.url=jdbc:postgresql://localhost:5432/forum?useSSL=false
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true
spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true
spring.jpa.properties.hibernate.format_sql=true
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
I tried to switch my postgres build from runtimeOnly to implementation (I'm using gradle) Even try to specified the dialect, but nothing changed