How to use persistence.createTransaction() that takes a String parameter

Good day

I am trying to

  1. Creates a new transaction.
  2. Suspend the existing transaction

There is a function available persistence.createTransaction() which takes a String parameter used for suspending the existing transaction and starting a new one. What is the String that is required as parameter and where do i find it.

Thank you

Hi,

An excerpt from the Persistence interface source code:

    /**
     * Creates a new transaction in the main data store.<br>
     *
     * @see #createTransaction(String)
     */
    Transaction createTransaction();

    /**
     * Creates a new transaction.<br>
     * If there is an active transaction, it will be suspended.
     *
     * @param storeName data store name
     * @return object to control the new transaction
     */
    Transaction createTransaction(String storeName);

The Javadocs are also available if you press Ctrl+Q (Windows/Linux) or F1 (macOS) on the method in the code editor.
show-javadocs

Thank you @knstvk for your response.

Can you please explain to me where I can find the String parameter of the createTransaction(String storeName). Tried reading about the storeName but could not figure where to find it in my project folder. What is a storeName and where do i find it?

Thank you

This parameter is important only if you have defined an additional data store in your project. Then when you want to create transaction or EntityManager for working with entities of this store, you should specify its name.

The name of the additional store is displayed in Project Properties window on Data Stores tab in Studio. It is defined in the cuba.additionalStores app property, see the docs.