aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Implement store procedure in EJB !!!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Implement store procedure in EJB !!!!" Watch "Implement store procedure in EJB !!!!" New topic

Implement store procedure in EJB !!!!

Bill Dao

Joined: Nov 14, 2003
Posts: 7
For last, I used to write store procedure, trigger in SQL Server 2000. And now I want to move store procedure code, trigger code and implement it into EJB technology. Can you help me how to do it ?. Thanks a lot.
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8898

Why not start with Suns EJB tutorial

Bill Dao

Joined: Nov 14, 2003
Posts: 7
I read Sun EJB Tutorial, but you know that you can create temporary table and you can use cursor in store procedure. For example with code of SP
CustomerID int,
TotalMoney numeric)
SELECT a.CustomerID, SUM(a.Total1) FROM table1 a
GROUP BY a.CustomerID
SELECT b.CustomerID, SUM(b.Total2) FROM table1 b
GROUP BY b.CustomerID
UPDATE #TempTable SET TotalMoney=0 WHERE CustomerID<=0
SELECT CustomerID, TotalMoney FROM TempTable
I want to how to write similar code which can do it in EJB. Thanks for your attention.
Kyle Brown
Ranch Hand

Joined: Aug 10, 2001
Posts: 3879
You would do this in Java, using Java objects to hold the intermediate values instead of a temporary table.

Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at for other WebSphere information.
Bill Dao

Joined: Nov 14, 2003
Posts: 7
Thanks for your reading. Can you show me detail of this problem ?. If you can't, can you help me to tel me the reference links which describes this problem ?
Pranab Ghosh

Joined: Dec 18, 2003
Posts: 1
you could use stateless session beans or entity beans with BMP to wrap
your stored procedures
Bill Dao

Joined: Nov 14, 2003
Posts: 7
Can you give me the example code which implements what you tell me ?. Thanks for your attention.
Lasse Koskela

Joined: Jan 23, 2002
Posts: 11962
I believe Bill is not looking to call the stored procedure from an EJB but rather get rid of the stored procedure and implement the same logic in Java...

Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
It is sorta covered in the JavaRanch Style Guide.
subject: Implement store procedure in EJB !!!!
Similar Threads
using :new in oracle JDBC Query
Can we explicitly call triggers?
How to capture the exception in oracle trigger from Java client?
How to know when a table has new data?
Need a Better way for postgreSOL Triggers