shardingsphere icon indicating copy to clipboard operation
shardingsphere copied to clipboard

java not used @transactional annotation ,data cannot be updated

Open liushangqing9803 opened this issue 2 years ago • 4 comments

Configured a local transaction, found that only @transactional can be added to the method to take effect, resulting in some single update operation in the project plus @transactional annotation, it feels very troublesome. I don't know if I haven't configured it myself, or does the local transaction of shardingsphere have to add @transactional annotation to the method to take effect?

version: ShardingSphere-Proxy 5.1.1

liushangqing9803 avatar Jul 18 '22 09:07 liushangqing9803

When the next transaction is executed, the update statement that does not open the transaction will commit the transaction together

liushangqing9803 avatar Jul 19 '22 05:07 liushangqing9803

Can you provide the demo to reproduce the problem?

terrymanu avatar Jul 19 '22 08:07 terrymanu

@Service
public class StudentServiceImpl implements StudentService {
   //not used @Transactional , When this method is executed, the updated student data cannot be seen
    @Override
    public Long update(Student student) {
        return studentMapper.update(student);
    }

  //used @Transactional , normal execution
   @Override
    @Transactional
    public Long updateT(Student student) {
        return studentMapper.update(student);
    }
}

sql:

update student set name='xxx' where id=1

liushangqing9803 avatar Jul 19 '22 09:07 liushangqing9803

Can you give me a simple runnable demo to investigate this issue,thank you. @liushangqing9803

FlyingZC avatar Aug 05 '22 09:08 FlyingZC

Hello , this issue has not received a reply for several days. This issue is supposed to be closed.

github-actions[bot] avatar Oct 08 '22 16:10 github-actions[bot]

Close due to no response.

TeslaCN avatar Dec 27 '22 06:12 TeslaCN