Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring Batch Transaction Exception:Existing transaction detected in JobRepository

I am trying this and get exception: java.lang.IllegalStateException: Existing transaction detected in JobRepository. Please fix this and try again (e.g. remove @Transactional annotations from client).

Is there anyone who have encountered this problem?

   @Transactional(propagation = Propagation.REQUIRED)
public void method1() // this method must be Transactional 
{

    ...    /*code to call JMS services*/

  method2();
}

@Transactional(propagation = Propagation.NOT_SUPPORTED)
public void method2()
{
  batchService.runJobWithId(123L);
}
like image 411
sb_turan Avatar asked Nov 01 '22 14:11

sb_turan


1 Answers

Try removing @Transactional(propagation = Propagation.NOT_SUPPORTED) from method2()

like image 124
mady Avatar answered Nov 09 '22 16:11

mady