Hello Friends, I was reading entity beans from ed roman, there it is mentioned that to find out which entity bean is to be removed(when ejbRemove() is invoked). we should take primary key from ctx.getPrimaryKey(). My problem is that each entity bean instance represents a single row in a table, so we can easily store primary key as an instance variable, and use that variable whenever required. why take trouble to call ctx.getPrimaryKey()? plz clear my doubts
Prakash Dwivedi (SCJP2, SCWCD, SCBCD)
"Failure is not when you fall down, Its only when you don't get up again"
sharp shooter, and author
posted 13 years ago
It's probably to be on the safe side, to ensure that the correct bean is removed. As bean instances are pooled by the container, it is possible that an instance variable representing the PK field might not get set correctly when the bean instance is bought into an active state with identity. Anybody else have any thoughts about this? Simon