aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes How to call stored procedures in ejb2.1? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "How to call stored procedures in ejb2.1?" Watch "How to call stored procedures in ejb2.1?" New topic
Author

How to call stored procedures in ejb2.1?

RajendraKr Kumar
Greenhorn

Joined: Mar 17, 2006
Posts: 6
I have already put this in JBoss forum but i have not got any answer
"I have been asked to use stored procedures,i have used ejb-ql and jboss-ql but i don't know how i can call a stored procedure in my ejb and what will i write in ejb-jar and jbosscmp-jdbc xml file."
Ådne Brunborg
Ranch Hand

Joined: Aug 05, 2005
Posts: 208
I don't know jboss, but to my knowledge ejb-ql does not support stored procedures. You need to use PreparedStatement and execute the stored procedure as you would an SQL-query.

for instance



Entia non sunt multiplicanda praeter necessitatem
RajendraKr Kumar
Greenhorn

Joined: Mar 17, 2006
Posts: 6
Hello Adne Brunborg ,
Thanks for your answer, but i am using CMP only, so how can i call stored procedure using CMP.
Ådne Brunborg
Ranch Hand

Joined: Aug 05, 2005
Posts: 208
You can't. Sorry.

Had exactly the same situation just one month ago. Company Policy is to use CMP only and no PreparedStatement. But when it became neccesary to call a stored procedure, this had to change.

Bottom line is, don't get too hung up in "using CMP only". Entity beans have their limitations, and this is one of them. Entity beans can't use business logic in the persistent store (i.e. database).

I am assuming you call your CMP beans from a SessionBean, right?
[ March 23, 2006: Message edited by: �dne Brunborg ]
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17257
    
    6

I have already put this in JBoss forum but i have not got any answer


Did you delete the one in JBoss? Nope, I closed that one. Please don't duplicate post. While JBoss really wasn't the right forum for the question, usually the bartender will move it to the correct forum, but didn't get a chance at that point. If that happens again, you can delete your original thread by clicking on the edit icon, then there is a check box on the next page to delete the post. When you delete and it is the post that is the thread starter, then the whole thread will be deleted, which is what you want in that case.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to call stored procedures in ejb2.1?