aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes EJB Transactions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "EJB Transactions" Watch "EJB Transactions" New topic
Author

EJB Transactions

Gurumurthy Ramamurthy
Ranch Hand

Joined: Feb 13, 2003
Posts: 272
Hi,

We are having an instance of entity bean which is doing some transactions with a piece of data from DB. What happens when you delete that specific data (on which the entity bean instance is working) is removed externally from the DB?

Thanks,
Guru
Vijay Sharma
Ranch Hand

Joined: Feb 02, 2005
Posts: 32
Then in that case,It may throw some Exception.


Vijay Sharma
Malli Raman
Ranch Hand

Joined: Nov 07, 2001
Posts: 312
Originally posted by Gurumurthy Ramamurthy:
Hi,

We are having an instance of entity bean which is doing some transactions with a piece of data from DB. What happens when you delete that specific data (on which the entity bean instance is working) is removed externally from the DB?

Thanks,
Guru


It is similar to one user deletes the record while another user is trying to read the data.
Anna Madhusudhanan Natanagopalan
Greenhorn

Joined: Apr 05, 2004
Posts: 25
Hi,
that depends upon your Database server (Isolation level). It does not allow to delete. if it is then the Entity bean throws Exception.
Valentin Tanase
Ranch Hand

Joined: Feb 17, 2005
Posts: 704
Hi Guru,

I would subscribe to what Anna just said and I�d like to bring one more idea: it could depend upon the concurrency strategy your container implements. If you use WebLogic for example, there are four concurrency strategies you can use:
  • Exclusive
  • Database
  • Read-only
  • Optimistic

  • Without getting into many details, I�ll tell you that the default strategy for WL is the second one, the database concurrency strategy, which will basically use the underlying database system to deal with this problem (prior to WL 6 the first one was the default). So the transaction isolation level plays a major role here. Is my believe that if you try to remove the data from the db while the bean is executing the transaction you�ll get an error message no matter what.
    By using another concurrency strategy the result might be different. Using the Read-only strategy for example might not result in any failure. The container will refresh the cache after a specified amount of time and the bean will be removed from the cache if it is not found into the db anymore.


    I think, therefore I exist -- Rene Descartes
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: EJB Transactions