@Transactional in Spring Mybatis

48 views
Skip to first unread message

Swapna Ravi

unread,
May 13, 2020, 8:15:35 AM5/13/20
to mybatis-user

Hi


I have 2 transactions which accepts same input as below.


insert/update to Table A (int ID)
if above is success then insert to Table B (int ID)


If table B insert fails, the insert/updates to Table A should NOT roll back.
But if insert/update to table A fails, insert to table B should not happen.


How do I achieve with @transactional propagation & isolation levels?

Thanks
Swapna R

Kazuki Shimizu

unread,
May 17, 2020, 8:08:39 AM5/17/20
to mybatis-user
Could you provide a small reproduce project?

Swapna Ravi

unread,
May 17, 2020, 10:36:51 AM5/17/20
to mybati...@googlegroups.com
Without any @ transactional by default my use case works. Is that fine ..

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mybatis-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mybatis-user/cd230723-d908-4aad-9ba2-bee020c9653f%40googlegroups.com.

Biao Huang

unread,
Nov 19, 2020, 10:25:50 PM11/19/20
to mybati...@googlegroups.com
The 2 calls should be in separated transactions, normally there are 2 ways to accomplish it:
1. without @Transactional
2. @Transactional(propagation = Propagation.REQUIRES_NEW)

Swapna Ravi <swapn...@nielsen.com> 于2020年5月17日周日 下午10:36写道:


--
=====================================
QQ:     26664141
Skype: biao.mac
EMail:  biao...@gmail.com

Tel: Home:  495312217000
Tel: Mobile: 4917620793369
Reply all
Reply to author
Forward
0 new messages