Insert my own logic into container generated setters in EJB 2.0

Discussions

EJB programming & troubleshooting: Insert my own logic into container generated setters in EJB 2.0

  1. Does anyone know if it is possible (and how) to insert my own logic into the container generated setters under EJB 2.0 CMP?

    Thanks,
    Rick
  2. To my knowledge, the spec does not define any standard method for doing that.
    IMHO, the spec shouldn't define that anyway. You can make your own setters with whatever logic you need, and make them call the container setters (using different names). Why over-bloat the spec with things we can already do?

    Gal
  3. Steady gal, I suspect that's what Rick wants.

    Rick, just define setThisX in the remote but don't expose the true setter. In the implementation class implement both setThis (for the container) and setThisX. Have the latter method so any extra processig and then call setThis when it is ready.

    Hey presto.
  4. Thanks, Gal and Mike. Without going into lengthy detail on our overall design and this particular problem, it looks like a variation on Gal's idea will accomplish what we need. Thanks again!