Large Objects may not be used in auto-commit mode

后端 未结 6 559

I have a Spring application which uses Hibernate on a PostgreSQL database. I\'m trying to store files in a table of the database. It seems it stores the row with the file (I

6条回答
  •  执笔经年
    2020-12-03 07:22

    Instead of using @Transactional, all I did for this issue was to update this column in PostgreSQL DB from oid type to bytea type and added @Type for the @Lob field.

    i.e.

    ALTER TABLE person DROP COLUMN image;
    ALTER TABLE person ADD COLUMN image bytea;
    

    And changed

    @Lob
    private byte[] image;
    

    To

    @Lob
    @Type(type = "org.hibernate.type.ImageType")
    private byte[] image;
    

提交回复
热议问题