jQuery in Action, 2nd edition*
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 Murach's Java Servlets and JSP this week in the Servlets 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
Author

Implement store procedure in EJB !!!!

Bill Dao
Greenhorn

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: 8904

Why not start with Suns EJB tutorial


Groovy
Bill Dao
Greenhorn

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
CREATE TABLE #TempTable(
CustomerID int,
TotalMoney numeric)
INSERT INTO #TempTable
SELECT a.CustomerID, SUM(a.Total1) FROM table1 a
GROUP BY a.CustomerID
INSERT INTO #TempTable
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
GROUP BY CustomerID
I want to how to write similar code which can do it in EJB. Thanks for your attention.
Kyle Brown
author
Ranch Hand

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


Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at http://www.kyle-brown.com/ for other WebSphere information.
Bill Dao
Greenhorn

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
Greenhorn

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

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
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
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]
 
wood burning stoves
 
subject: Implement store procedure in EJB !!!!
 
Similar Threads
Can we explicitly call triggers?
using :new in oracle JDBC Query
How to know when a table has new data?
Need a Better way for postgreSOL Triggers
How to capture the exception in oracle trigger from Java client?