Thanks for the hint, but sorry, there is still the same error, probably because useInputStreamToInsertBlob() wasn't called:
Here comes the added line in persistence.xml:
Code:
<property name="hibernate.dialect" value="mapping.MyPostgreSQLDialect"/>
And here is MyPostgreSQLDialect.java:
Code:
package mapping;
public class MyPostgreSQLDialect extends org.hibernate.dialect.PostgreSQLDialect {
@Override
public boolean useInputStreamToInsertBlob() {
return true;
}
@Override
protected void registerColumnType(int code, String name) {
super.registerColumnType(code, name);
}
}
A breakpoint at "super.registerColumnType(code, name);" was hit many times, therefore I assume that the added property in persistence.xml is active.
But a breakpoint at "return true" was never hit!
Also a breakpoint at org.hibernate.type.ByteArrayBlobType.set(PreparedStatement, Object, int, SessionImplementor) wasn't hit.
(This method contains a call to useInputStreamToInsertBlob().)
Here is the error output:
Code:
16:20:37,365 WARN JDBCExceptionReporter:100 - SQL Error: 0, SQLState: 42804
16:20:37,381 ERROR JDBCExceptionReporter:101 - Batch-Eintrag 0 insert into "Foo" ("someBytes", "id") values ('<stream of 3 bytes>', '0') wurde abgebrochen. Rufen Sie 'getNextException' auf, um die Ursache zu erfahren.
16:20:37,381 WARN JDBCExceptionReporter:100 - SQL Error: 0, SQLState: 42804
16:20:37,381 ERROR JDBCExceptionReporter:101 - FEHLER: Spalte »someBytes« hat Typ oid, aber der Ausdruck hat Typ bytea
Hinweis: Sie müssen den Ausdruck umschreiben oder eine Typumwandlung vornehmen.
Position: 47