org.postgresql.util.PSQLException: Large Objects may not be used in auto-commit mode

后端 未结 1 897
粉色の甜心
粉色の甜心 2020-12-21 17:43

I am using Spring , JPA, Hibernate, Postgresql. I can upload/insert a file to the database. But I got the error when tried to access the file.

EVERE: Servle         


        
相关标签:
1条回答
  • 2020-12-21 18:09

    Since you have defined your Spring transactions via @Transactional, you are by default running inside of an auto-commit transaction. As per this other thread, you need to create a second session factory which runs in autocommit = false to retrieve the file.

    Additionally, the DAO for the retrieval should be annotated with @Qualifier so that it knows which session factory to use. Example:

    @Autowired
    public MyDAOImpl(@Qualifier("someSessionFactory") SessionFactory sessionFactory) {
       setSessionFactory(sessionFactory);
    }   
    
    0 讨论(0)
提交回复
热议问题