aspose file tools*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes entity bean remove Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "entity bean remove" Watch "entity bean remove" New topic
Author

entity bean remove

Chetan Sahasrabudhe
Ranch Hand

Joined: Aug 09, 2004
Posts: 75
Hello

Enitity bean calls remove(Object object) method on entity bean, then the bean is deleted.

What happens when two EJBObjects (EJBObject_1 and EJBObject_2) are representing a single row say
#10-Valentin Crettaz

Now EJBObject_1 gets a call to remove #10 and that too it is in transaction. What will be the containers approach.

1. Delete the row, remove EJBObject_1, return bean to pool, but then EJBObject_2 will be in a bad state, as the client might get exception on calling methods on EJBObject_2.

2. Do not delete the row, more of like do nothing, but then EJBObject_1 is in transaction and the operation is not happening as desired.

How to handle this situation in my client code ?


Thanks & Regards<br />Chetan
Chengwei Lee
Ranch Hand

Joined: Apr 02, 2004
Posts: 884
Enitity bean calls remove(Object object) method on entity bean, then the bean is deleted.


Normally, it is your client codes that invokes the remove(Object pk) method rather than another entity bean. Remember, an entity bean is a noun. It represents something rather than do something (verb - session beans). If you're thinking of the parent-child (CMR) kind of relationship, you'd be using cascade delete in the DD instead.

What happens when two EJBObjects (EJBObject_1 and EJBObject_2) are representing a single row say #10-Valentin Crettaz

Now EJBObject_1 gets a call to remove #10 and that too it is in transaction. What will be the containers approach.


When the client invokes a method from the component interface of a bean that had been removed, an exception will be thrown. Thats the way containers inform the client that the bean is no longer there.


SCJP 1.4 * SCWCD 1.4 * SCBCD 1.3 * SCJA 1.0 * TOGAF 8
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: entity bean remove