• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

Throwing RemoveException in ejbRemove() with setRollbackOnly()

 
Ranch Hand
Posts: 569
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If an CMP ebean throws RemoveException in ejbRemove() but doesnt mark the txn for RollbackOnly, will the db record be removed eventually when the txn commits?

Which section of the spec can I find the info for this situation?
 
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The container always invokes ejbRemove() on session beans within an unspecified transaction context. This means that the container does not have to rollback any transaction in case RemoveException is thrown (section 7.6.1).

For entity beans the story is a little different as explained in sections 10.5.2 and 10.5.3. Moreover, 10.5.8.5 states the following:


From the client´┐Żs perspective, a RemoveException (or a subclass of RemoveException) indicates that an application level error occurred during a remove(...) operation. If a client receives this exception, the client does not know, in general, whether the entity object was removed or not. The client also does not know if the transaction has been marked for rollback. (However, the client may determine the transaction status using the UserTransaction interface.)

The Container or Bean Provider throws the RemoveException (or subclass of RemoveException) from a remove method to indicate an application-level error from the entity object removal operation. Optionally, the Container or Bean Provider may mark the transaction for rollback before throwing this exception.

The Container or Bean Provider is encouraged to mark the transaction for rollback only if data integrity would be lost if the transaction were committed by the client. Typically, when a RemoveException is thrown, it leaves the database in a consistent state, allowing the client to recover. The Container treats the RemoveException as any other application exception.



Hope this helps
 
We can walk to school together. And we can both read this tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic