I have another novice question. How to call database stored procedures in EJB? Can I use CMP and also call stored procedures ?? Any articles or books which explains this. Thank you for your responses. Regards, Rashmi
That's the catch with CMP Entity Beans. The container will write the SQL for you. Most container vendors, I would imagine, will not let you hack the logic that generates the SQL statements (Although you should check the docs for your container). The db relationships in our shop are complex so we use BMP Entity Beans with Data Access Objects (DAOs) which use stored procedures.
"I believe in coyotes and time as an abstract Explain the change the difference between What you want and what you need there's the key"
I think you can still use stored procedure in CMP entity beans. CMP will take care of the persistence for your fields. But I think it's ok to have a few concrete methods in your beans class which has some calls to the stored procedure.
SCJP, SCJD, SCWCD, SCBCD, SCEA, IBM Certified Enterprise Developer, WebSphere Studio V5.0
As of I know EJB-QL doesn't support direct call to store procedure. If you look at theory how EJB-QL know about Oracle or any other db provider function? It's up to container to provide such access method. But again I am not completely sure with CMP. You can do that BMP because container will tell when to sync with db & bean provider will write all SQL related code. In that case you will use java.sql.* (or other) API to make db connection & call to store procedure. I mean it becomes JDBC programming from that point. Hope this help.
SCJP, SCWCD, SCBCD, SCJD, BB Java2 and JSP1.1
Mo-om! You're embarassing me! Can you just read a tiny ad like a normal person?
Free, earth friendly heat - from the CodeRanch trailboss