quarkus: Hibernate Reactive with Panache can't insert into a jsonb column

Describe the bug

I’m using Quarkus Hibernate Types to map some attributes of my entity to PostgresSQL’s jsonb column type.

If I use the regular JDBC driver, it works normally.

However, when using Hibernate Reactive, querying works, but inserting new entities fail with the error:

{"details":"Error id 3c00e4fb-6fc9-4953-9594-0410fa4c9093-1, io.vertx.core.impl.NoStackTraceThrowable: Parameter at position[0] with class = [com.fasterxml.jackson.databind.node.ObjectNode] and value = [{\"field\":\"value\"}] can not be coerced to the expected class = [java.lang.Object] for encoding.","stack":"io.vertx.core.impl.NoStackTraceThrowable: Parameter at position[0] with class = [com.fasterxml.jackson.databind.node.ObjectNode] and value = [{\"field\":\"value\"}] can not be coerced to the expected class = [java.lang.Object] for encoding."}

Expected behavior

It should insert the entity with no error.

Actual behavior

The entity is not inserted and an error occurs.

How to Reproduce?

  1. Clone this repo
  2. Run docker-compose up to start the db
  3. Run ./mvnw quarkus:dev to start the app
  4. Run the following curl to try to insert data:
curl -X POST -H 'Content-Type: application/json' -i http://localhost:8080/example --data '{
  "id": 3,
  "content": { "yetAnotherField": "yetAnotherValue" }
}'

If you run curl -X GET -i http://localhost:8080/example, it works perfectly.

Output of uname -a or ver

Microsoft Windows [version 10.0.19043.1288]

Output of java -version

java version “11.0.12” 2021-07-20 LTS Java™ SE Runtime Environment 18.9 (build 11.0.12+8-LTS-237) Java HotSpot™ 64-Bit Server VM 18.9 (build 11.0.12+8-LTS-237, mixed mode)

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.4.1.Final

Build tool (ie. output of mvnw --version or gradlew --version)

Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d)

Additional information

No response

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 2
  • Comments: 17 (12 by maintainers)

Most upvoted comments

I’ve created this issue on Hibernate Reactive: https://github.com/hibernate/hibernate-reactive/issues/1180 Maybe we can do something for making this easier to handle

Thanks for your feedback! It was really helpful