How to configure the java transaction with .xml configuration that both errors can be rolled back?

I know how to write this with annotations:
@ Transactional (rollbackFor= {RuntimeException.class, Exception.class})
so how to configure it with xml?

:CustomExceptionException

clipboard.png

TbProduct product = this.addProduct(dto, user);
if(1==1){
    throw new CustomException(9999,"test");
}

according to the configuration below, if an error is reported during the running of the program, it will not be rolled back (CustomException is supposed to be a subclass of Exception, but the rollback is only caused by CustomException, but if there is a problem with my rollback-for= "Exception", the above addProduct () will not be rolled back)

<tx:advice id="txAdvice" transaction-manager="transactionManager">
        <tx:attributes>
            <!--  -->
            <tx:method name="*" rollback-for="com.mal.vo.CustomException" />
            <tx:method name="save*" propagation="REQUIRED" />
            <tx:method name="insert*" propagation="REQUIRED" />
            <tx:method name="add*" propagation="REQUIRED" />
            <tx:method name="create*" propagation="REQUIRED" />
            <tx:method name="delete*" propagation="REQUIRED" />
            <tx:method name="update*" propagation="REQUIRED" />
            <tx:method name="find*" propagation="SUPPORTS" read-only="true" />
            <tx:method name="select*" propagation="SUPPORTS" read-only="true" />
            <tx:method name="get*" propagation="SUPPORTS" read-only="true" />
        </tx:attributes>
    </tx:advice>

Apr.03,2021

RuntimeException inherits from the Exception class.

//ExceptionException
@Transactional(rollbackFor=Exception.class)

so just configure an Exception class for your xml.

  <tx:method name="*" rollback-for="Exception"/>
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eac96d-20f0.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eac96d-20f0.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?