transactions

"tadta" <[email protected]> Mon, 01 Apr 2002 14:08:14 -0000
Newsgroups gmane.comp.java.ejb.general
Message-ID <[email protected]>
Hello,

please reply for this 

Transaction1
In one jsp page(jsp1) we have the following
connection.commit = false
update table1 set column=value
update table2 set column=value
connection.commit = true

Transaction2
In another jsp page(jsp2) we have the following
connection.commit = false
update table2 set column=value
update table1 set column=value
connection.commit = true

Note:  transaction1 first updates table1 and then table2 , while 
transaction2
first updates table2 and then table1
Now is there a chance of database deadlock being created here because 
table1 is locked
by transaction1 while table2 is locked by transaction2 then 
transaction1 waits for table2
while transaction2 waits for table1

How to handle this in jsp code?
If EJB is used how does that solve this problem?
To solve this kind of problem alone is EJB advisible or we can do 
that in code?

regards,
Javid