Hello Diego,
You are correct, the answer is yes for both questions. For a multi threaded application, you need to get a new Database object.  The database object when used will return a new connection every time. In my understanding castor is not multithreaded internally therefore if you use only one connection and the different threads perform the transactions. When txn.commit is called at the end of the transaction,it will close the first transaction completed by one of the threads and all the other threads with incomplete transactions rollback.
 Hope this helps
Dutta:)
 
 

--------------------------------------------
Satadip Dutta                            
Software Design Engineer                
Manageability Solutions Lab              
Hewlett-Packard                           
Fort Collins, CO                         
Telephone : 970-898-3644                 
--------------------------------------------

-----Original Message-----
From: Diego Vallespir [mailto:[EMAIL PROTECTED]]
Sent: Saturday, March 09, 2002 2:10 PM
To: [EMAIL PROTECTED]
Subject: [castor-dev] multiple Database objects and threads

Hello:

    I need concurrent transactions, one transaction per thread.

    Is it a good solution to get a new Database object in each thread??
        db =3D ojb.getDatabase();

    this method return a diferrent connection every time we call it???

    I am asking this because I'm a little confused with the "client
aplication" or the "J2EE aplication". My english is no very good so it
is dificult to me to understand.
    I want to use the "client aplication" because it's easy, but it will
work for me if the answers of the two questions I ask is "yes"

Thanks a lot and sorry for my bad english,
                                                            Diego.

Reply via email to