As mentioned in this ticket -
https://jira.atlassian.com/browse/JRASERVER-25808
The workaround for using transactions with ActiveObjects in Jira (and what Atlassian is doing) would be to manually start a transaction:
import com.atlassian.jira.transaction.Transaction; import com.atlassian.jira.transaction.Txn; Transaction txn = Txn.begin(); try { ... txn.commit(); ... } finally { txn.finallyRollbackIfNotCommitted(); }
begin is declared as
/** * Represents the ability to peform a database transaction in JIRA. * * @since v4.4.1 */ public interface TransactionSupport { /** * This begins a new transaction if one is not already running for this thread. * <p> * It will be a NoOp if a transaction is already running and in this case a call to {@link * Transaction#commit()} will also be a NoOp. The outer caller is then reponsible * for the ultimate commit or rollback. * <p> * It will also be a NoOp if a transaction support in JIRA is turned off. * * @return a {@link Transaction} context object that you can called commit or rollback on * @throws TransactionRuntimeException if the transaction can not be established at all */ Transaction begin() throws TransactionRuntimeException; }
So to interact with Transaction interface, I need it reference the appropriate maven dependency. Where can I get the dependency? I am developing the plugin for JIRA 7.3.0.
Asked this question at wrong place, moved this to Atlassian developer community.
Heres the link if anyone wants -
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.