0

I am trying to delete multiple row using below method of but this is giving some exception. If any other alternative available for doing same JOB then please suggest.

deleteByCompositIdIn(List<CompositId> compositIdList)

<----- CompositId class given below ---->

@Embeddable
    public class CompositId {

        @Column(name="empFirstName")
        private String empFirstName;

        @Column(name="empId")
        private int empId;

        public String getEmpFirstName() {
            return empFirstName;
        }

        public void setEmpFirstName(String empFirstName) {
            this.empFirstName = empFirstName;
        }

        public int getEmpId() {
            return empId;
        }

        public void setEmpId(int empId) {
            this.empId = empId;
        }


    }

but getting below exception

failed: javax.persistence.TransactionRequiredException: No transactional EntityManager available
Rajeev
  • 519
  • 3
  • 13
  • 29
  • As the exception states you have no transaction. There is no your code so can't suggest proper way. E.g. you can mark the method as @Transactional – StanislavL Jul 22 '15 at 05:53
  • 1
    This might help you check out....http://stackoverflow.com/questions/25821579/transactionrequiredexception-executing-an-update-delete-query – goodyzain Jul 22 '15 at 05:55
  • Post code for function `deleteByCompositIdIn(List compositIdList)` – Yagnesh Agola Jul 22 '15 at 06:20
  • Can you please add your spring config? Especially the entityManager definition. @YagneshAgola The code is generated by Spring Data, I don't think the problem lies there. – BeWu Jul 22 '15 at 07:59

0 Answers0