4

We are exporting and importing data from postgres database using the pg tools from one server instance to another server instance:

eg: Export :

pg_dump.exe --file "my_table.sql" --host %connectionHost% --port "5432" --no-owner --username 'myUserName' --no-password --verbose --format=c --blobs --table "table_name" "MyDatabase"

eg: Import

pg_restore.exe --host "myhost" --port "5432" --username "myUserName" --no-password --dbname "MyDatabase" --data-only --verbose --schema "public" --table "table_name" "my_table.sql"

There are no errors either while exporting or importing the data. But when I try to open the page which has bytea(Lob) type column the application fails with the following error message in the log:

org.springframework.orm.jpa.JpaSystemException: Unable to access lob stream; nested exception is org.hibernate.HibernateException: Unable to access lob stream
...
Caused by: org.hibernate.HibernateException: Unable to access lob stream
at org.hibernate.type.descriptor.java.DataHelper.extractString(DataHelper.java:270)
...
 Caused by: org.postgresql.util.PSQLException: ERROR: large object 32882 does not exist
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2455)

My hibernate Resource is annotated with @Transactional It is working fine when we create the new data in an empty instance, only when we export the data from one instance to another we have this issue.

richyen
  • 8,114
  • 4
  • 13
  • 28
ryaliscs
  • 123
  • 9

0 Answers0