Bean Destruction
  • Example 15 shows the source code for destroying a Bid
  • Extremely simple
    • Delete row from database using primary key of Bid
    • Note the use of fEntityContext to retrieve the primary key
      • fEntityContext is set up by a common implementation class that BidImpl inherits from
      • The entity context is defined by the EJB spec and provides information about the environment the bean is executing in
      • The only reason this code is here is to deal with a bug in Enhydra
      • They fail to synchronize the instance with the DB prior to calling ejbRemove
      • So, using the instance data here gets stale data

Next Slide >>