Re: Transaction...
gbattine wrote:
....
The first bean creates an arraylist of statements,and each statements
created in the application has putted into arraylist.
Perhaps you should make a List of some entity object type or value object
type, so that you don't yet incur the overhead of making PreparedStatements.
At the end a queryManager loads the arraylist from the first bean,
reads it and executes the statements in a transaction.
> ...
> Why if i try to load an arraylist of statements stored in another bean
> transaction doesn't work?
> ...
> Can you say me another method to collect prepared statements and use it
> into a transaction?
At transaction time, open the transaction, use a single PreparedStatement
iteratively through the List, use its setParameter() methods inside the loop body.
Using the same PreparedStatement buys you some of the putative efficiency of
preparing statements. YMMV.
If the loop excepts or breaks abnormally, issue a rollback; if the loop
terminates nicely issue a commit.
In finally {} outside the loop, release any loose resources.
- Lew