I'd like to know whether it is possible to call a Postgres Stored Function (PLPGSQL) from within my EJB Session Bean. I've been searching for a clear example, but haven't come a clear cut example.
Jimmy Clark wrote:
I'd like to know whether it is possible to call a Postgres Stored Function (PLPGSQL) from within my EJB Session Bean. I've been searching for a clear example, but haven't come a clear cut example.
Instead of "searching the Internet" for an example, I'd suggest spending some time thinking about the task and working your own solution. Code statements or functionality for calling external systems would not be written in the EJB classes. This is not their intended use. Session EJB are intended to execute business/domain logic and should do this via Business Object. The Business Object contains business logic and uses a Data Access Object to execute data access logic. The connection to a external system such as a relational database happens via Data Access Object and the code statements for this are in the Data Access Object, not the Session EJB or the Business Object.
If you code business logic or data access object directly in EJB classes, then you are creating a dependency directly on the EJB API in general and a "specific version" of the API as well. This is a poor design with restricted ability to handle change over time.
...then I'm thinking a stored procedure call would require some code in the Entity Beans as well a DAOs.
So are you saying EJB technology is not an efficient way to access large databases?
(SCJP 5, OCA 9i)
(Always interested in learning)