How to implement container managed transaction (CMT)?

后端 未结 3 902
余生分开走
余生分开走 2020-12-16 22:06

I wanted to persist an object(ReportBean) to the database, but I got error message:

javax.persistence.TransactionRequiredException: Transactio         


        
3条回答
  •  爱一瞬间的悲伤
    2020-12-16 22:27

    update to java EE 7 (CDI 1.1), you can now use @Transactional to enable the CMT in CDI beans, no need to use EJB anymore.

    reference:JEE7: Do EJB and CDI beans support container-managed transactions?

提交回复
热议问题