Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You've asked a number of questions at once, but I'll do the best I can to answer them.</p> <ul> <li>Marking a service as @Transactional associates it with the current JTA (Java Transaction API) transaction (or creates one if required)</li> <li>Depending on how your datasources are configured, JDBC connections will typically also be associated (enlisted) into the transaction</li> <li>If a connection is associated with a JTA transaction then anything that is executed on it will take place within a database transaction.</li> <li>In Sybase ASE, you cannot create (or drop) a table inside a transaction.</li> </ul> <p>So, marking your service as @Transactional will prevent you from executing a proc that contains create table statements.</p> <p>However, that won't solve the problem you're facing anyway. Marking something @Transactional, simply means that it executes inside a JTA transaction. And that means that it either commits, or rolls-back, but it doesn't guard against concurrent access.</p> <p>You have a few options</p> <ul> <li>If you know that your application will only ever run on a single VM, then you can mark the code as <code>serialized</code>. This will make sure the VM only ever has 1 thread inside that code at a time.</li> <li>You can implement concurrency controls inside the proc, (e.g. use <code>lock table</code>), but that will require a transaction, which will prevent you from creating a table inside the procedure.</li> <li>Or you can redesign your application to not have to jump through all these hoops.</li> </ul> <p>There are probably easier ways of achieving the outcome you're looking for - creating and dropping tables inside a proc, and then trying to prevent concurrent access to that proc is not a typical way of solving a problem.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload