question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add mapper from bytea to BLOB

See original GitHub issue

I have column byteea in postgres table speedment coverts to Optional<Blob>

When I stream data i get error

com.speedment.runtime.core.exception.SpeedmentException: org.postgresql.util.PSQLException: Bad value for type long : \x230d0a23546875204665622030382031383a35353a323720474d5420323031380d0a6d794b65793d6d7956616c75650d0a

Full stack trace

2018-02-17T12:57:28.227Z ERROR [main] (c.s.r.c.i.s.b.AbstractStreamBuilder) - org.postgresql.util.PSQLException: Bad value for type long : \x230d0a23546875204665622030382031383a35353a323720474d5420323031380d0a6d794b65793d6d7956616c75650d0a
com.speedment.runtime.core.exception.SpeedmentException: org.postgresql.util.PSQLException: Bad value for type long : \x230d0a23546875204665622030382031383a35353a323720474d5420323031380d0a6d794b65793d6d7956616c75650d0a
	at com.company.public_.scheduledemo.public_.qrtz_job_details.generated.GeneratedQrtzJobDetailsSqlAdapter.apply(GeneratedQrtzJobDetailsSqlAdapter.java:56)
	at com.speedment.runtime.core.internal.stream.StreamUtil$ResultSetIterator.forEachRemaining(StreamUtil.java:196)
	at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
	at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580)
	at com.speedment.runtime.core.internal.component.sql.override.def.reference.DefaultForEachTerminator.apply(DefaultForEachTerminator.java:47)
	at com.speedment.runtime.core.internal.manager.sql.SqlStreamTerminator.forEach(SqlStreamTerminator.java:101)
	at com.speedment.runtime.core.internal.stream.builder.ReferenceStreamBuilder.lambda$forEach$0(ReferenceStreamBuilder.java:165)
	at com.speedment.runtime.core.internal.stream.builder.AbstractStreamBuilder.finallyClose(AbstractStreamBuilder.java:178)
	at com.speedment.runtime.core.internal.stream.builder.ReferenceStreamBuilder.forEach(ReferenceStreamBuilder.java:165)
	at com.company.public_.Test.main(Test.java:18)
Caused by: org.postgresql.util.PSQLException: Bad value for type long : \x230d0a23546875204665622030382031383a35353a323720474d5420323031380d0a6d794b65793d6d7956616c75650d0a
	at org.postgresql.jdbc.PgResultSet.toLong(PgResultSet.java:2859)
	at org.postgresql.jdbc.PgResultSet.getLong(PgResultSet.java:2113)
	at org.postgresql.jdbc.PgResultSet.getBlob(PgResultSet.java:417)
	at com.company.public_.scheduledemo.public_.qrtz_job_details.generated.GeneratedQrtzJobDetailsSqlAdapter.apply(GeneratedQrtzJobDetailsSqlAdapter.java:54)
	... 9 more

Process finished with exit code 1

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
julguscommented, Feb 20, 2018

Thank you, as you pointed out it’s the job_data column that causes the error. Currently, Speedment doesn’t support the mapping of a bytea to a Blob.

There are a few possible options to work around this issue:

  1. To create your own TypeMapper from bytea to Blob.
  2. Express the value as a String and parse it manually.
  3. Or lastly, change the column type to a Blob type.
0reactions
muhdkhokharcommented, Feb 20, 2018

OK thanks . I’ll update it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Force Liquibase to map Blob to BYTEA on PostgreSQL
For liquibase 3.4, I didn't have to to do this. I just put the column type as BLOB and then liquibase would generate...
Read more >
how mybatis insert/delete blob, large object, bytea columns in ...
Hello,. Is there an online doc about how mybatis deal with(add, update, remove) large object (postgresql8.3)?. <insert id="" parameterType="?" >
Read more >
Hibernate Binary Data and BLOB Mapping Example
This tutorial shows you how to map byte array (byte[]) or Binary Large Object (java.sql.Blob) of Java type to database type using Hibernate ......
Read more >
postgres: Read blob/bytea as stream via LargeObject api #1706
I tried using mapTo(InputStream.class) and mapTo(Blob.class) , but both failed with a NoSuchMapperException . It seems to work with mapTo ...
Read more >
Programmatically inserting images as binary data (BLOB) in ...
I have added another field of bytea type, named img_blob, to the table and configured the attribute form in such a way that, ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found