TransactionRequiredException Executing an update/delete query

后端 未结 20 2079
没有蜡笔的小新
没有蜡笔的小新 2020-12-02 15:29

Hi I am using hibernate JPA with spring and mongodb and i am running my application on Glassfish-4.0.

My service class is :

@Component
public class T         


        
20条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-02 15:52

    I was facing the same error inspite of adding @Transactional annotation at class level and importing org.springframework.transaction.annotation.Transactional.

    Then I realized that since I was using hibernate query, I had imported javax.persistence.Query instead of import org.hibernate.query.Query. Therefore adding import org.hibernate.query.Query solved the issue for me.

    I hope this idea helps someone.

提交回复
热议问题