Search code examples
jpawebspherejpa-2.0ejb-3.0websphere-7

Possibility to use JPA without EJB inside WebSphere module


I have a WebSphere ESB 7.5 hosting a web service (inside a mediation module). The data from the web service should be stored to a DB. DB access should be performed via JPA.

I would like to utilize JPA with WebSphere's container-managed transactions (so JPA just replaces plain SQL calls and that's it). I don't want to generate an EJB from this tutorial. This seems unnecessary for my case.

Is it possible? Any code example?


Solution

  • There is nothing in the JPA specification that mandates it be used in an application container or via EJB's. But, as to your second condition, container managed transactions are defined at the level of the container, and more specifically, they are only valid for use in entity beans. So, your options are to use:

    • JPA + non-entity beans + user transactions
    • JPA + entity beans + container managed transaction.