This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to call stored procedures in ejb2.1?

 
RajendraKr Kumar
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 208
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

 
RajendraKr Kumar
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 208
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 17276
6
IntelliJ IDE Mac Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic