Transaction and Private Methods in EJB

Discussions

EJB programming & troubleshooting: Transaction and Private Methods in EJB

  1. Transaction and Private Methods in EJB (1 messages)

    I have been trying to set transaction attribute for a private method in EJB but never seem to be working.

    I have few questions:

    1. Is it possible to pass transaction context from a public method to private method within same stateless session Bean?

    2. If we can pass the context, can we change or suspend the transaction in the private method?

    Any thoughts? Thank you.

    Krish
  2. If a method's private, it cannot be invoked remotely. If it cannot be invoked remotely, the container isn't interested in it.

    You do not "pass" a transaction context around. It is normally attached to the servicing thread.

    You can manage the transaction context yourself, using bean managed transactions.