When writing a utility class to be used by EJBs, is there every any reason or advantage to make the class an EJB, rather than a standard java helper class?
In general I'd say no.
Reasons for making it an EJB would include:
- The class needs to be distributed, i.e. the operation needs to be performed in a different EJB server to that containing the client.
- The operations on the helper class need their own transactional semantics -- for instance an operation must happen in a seperate transaction to the operation being performed by the client of the helper class.
- The helper class contains some information from a datasource, *and* you wish to use an entity bean to manage it.
But if in doubt, make it an ordinary class. It can always turn into an EJB behind a facade later if it needs to.