org.jooq.exception.DataAccessException: SQL [insert into "public"."message" ("metadata") values (cast(? as varchar))]; Batch entry 0 insert into "public"."message" ("metadata") values (cast(NULL as varchar)) was aborted: ERROR: column "metadata" is of type json but expression is of type character varying Hint: You will need to rewrite or cast the expression. Position: 258 Call getNextException to see the cause.

GitHub | michaelsproul | 7 months ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    GitHub comment 5539#248537219

    GitHub | 7 months ago | michaelsproul
    org.jooq.exception.DataAccessException: SQL [insert into "public"."message" ("metadata") values (cast(? as varchar))]; Batch entry 0 insert into "public"."message" ("metadata") values (cast(NULL as varchar)) was aborted: ERROR: column "metadata" is of type json but expression is of type character varying Hint: You will need to rewrite or cast the expression. Position: 258 Call getNextException to see the cause.

    Root Cause Analysis

    1. java.sql.BatchUpdateException

      Batch entry 0 insert into "public"."message" ("campaign_id", "conversation_id", "start_state", "end_state", "link_followed", "kind", "sender", "recipient", "content", "metadata", "timestamp", "source") values (777, 15, '<<start>>', 'askEmail', 0, 'outbound_sms'::"public"."message_kind", '+61418974654', '+61434193516', 'Hi friend, what''s your email?', cast(NULL as varchar), 1474442678514002972, 0) was aborted: ERROR: column "metadata" is of type json but expression is of type character varying Hint: You will need to rewrite or cast the expression. Position: 258 Call getNextException to see the cause.

      at org.postgresql.jdbc.BatchResultHandler.handleError()
    2. org.postgresql.jdbc
      PgPreparedStatement.executeBatch
      1. org.postgresql.jdbc.BatchResultHandler.handleError(BatchResultHandler.java:148)
      2. org.postgresql.jdbc.PgStatement.executeBatch(PgStatement.java:780)
      3. org.postgresql.jdbc.PgPreparedStatement.executeBatch(PgPreparedStatement.java:1662)
      3 frames
    3. jOOQ
      BatchCRUD.execute
      1. org.jooq.tools.jdbc.DefaultStatement.executeBatch(DefaultStatement.java:93)
      2. org.jooq.impl.BatchSingle.executePrepared(BatchSingle.java:239)
      3. org.jooq.impl.BatchSingle.execute(BatchSingle.java:182)
      4. org.jooq.impl.BatchCRUD.executePrepared(BatchCRUD.java:159)
      5. org.jooq.impl.BatchCRUD.execute(BatchCRUD.java:100)
      5 frames
    4. rungopher.db_access
      DbMessage.persist
      1. rungopher.db_access.DbMessage.persist(DbMessage.java:46)
      1 frame
    5. rungopher
      CampaignEventHandler.handleDelivery
      1. rungopher.StartCampaign.sendFirstMessages(StartCampaign.java:166)
      2. rungopher.StartCampaign.start(StartCampaign.java:85)
      3. rungopher.CampaignEventHandler.handleDelivery(CampaignEventHandler.java:46)
      3 frames
    6. RabbitMQ Java Client
      ConsumerWorkService$WorkPoolRunnable.run
      1. com.rabbitmq.client.impl.ConsumerDispatcher$5.run(ConsumerDispatcher.java:144)
      2. com.rabbitmq.client.impl.ConsumerWorkService$WorkPoolRunnable.run(ConsumerWorkService.java:99)
      2 frames
    7. Java RT
      Thread.run
      1. java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      2. java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      3. java.lang.Thread.run(Thread.java:745)
      3 frames