Can beans use stored procedures in a database?
Created May 4, 2012
Richard Monson-Haefel Stored procedures can be used by session beans that access the database using JDBC and bean-managed entity beans that use JDBC to manage their own persistence. JDBC provides a call interface for using stored procedures. An example is provided below:
InitialContext cntx = new InitialContext( );
DataSource dataSource = (DataSource) cntx.lookup("java:comp/env/jdbc/mydatabase");
Connection con = dataSource.getConnection( );
CallableStatement storedProcedure = con.prepareCall("{? = call someprocedure [(?,?)]}");