Can an Entity Bean call a stored procedure using Container Managed Persistence ? If yes, how?

Dan Christopherson

If you mean "can you map the CMP Bean's persistence operations through stored procedures?", the answer depends on the sophistication of your chosen container's mapping tool and how tightly it integrates with your database. Sophisticated mapping tools are free to map your bean's CMP fields to whatever they want, however they want. However, many CMP tools are much simpler and expect to map to relational tables.

Now, if your question was more generally "Can a CMP bean call a stored procedure?", for example from a business method, or from ejb<Post>Create(...), the answer is a definite yes. Just specify the resource-reference in your ejb-jar.xml (as you will anyway), look up the DataSource to get a Connection, the do all the CallableStatement JDBC stuff you want.

0 Comments  (click to add your comment)
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



About | Sitemap | Contact