I'm a Java developer getting into EJB's, but not an EJB expert by any means. I recently started an EJB middleware project in which we had an EJB expert to layout the framework and get the ball rolling. Well he backed out last minute so they are looking to me to develop the EJB model.
Basically I have a transaction based system so it should be as simple as Client->Session Bean->Entity Bean->Database.
I need an example of how to use BMP Entities to access Stored Procedures, and also a simple diagram and snip of code to show how to grab the Entity Bean from the Session Bean would be great.
And if you know of any websites which show this I would be grateful. I've been to most of the standard newbie EJB sites, but can't get an answer to this.
Well the client wants to use EJB's due to other systems needing to remote in during later projects. We want to use stored procedures and from what I've read you have to then used BMP because CMP entity beans are 1-for-1 with a single table. Basically we want to use stateless session bean wrappers around the Entity beans.
This project doesn't really need EJB's, but it is what we were told to use.
In this case, I prefer not to use entity bean -- replace entity bean by Data Access Object (DAO)
Client->Session Bean->DAO ->Database.
DAO will encapsulate the call to store procedure and return Data Transfer Object (DAO) to session bean
Joined: Jun 15, 2004
Please excuse my ignorance, but I was basically treating the Entity bean as the DAO. Can you be a bit more specific?
Joined: Apr 19, 2005
Patrick, Since you have to use store procedures, I assume most of the persistence and transaction will be handled by the store procedures. I recommend to look up theDAO pattern which contains the implementation sammple code and the way to access DAO from SLSB. You'll need to call a proper store procedure in the method in the OracleXXXDAO class. E.g.
What you are describing is the Coarse Grained Session Bean Idiom at the bottom of that page which I actually suggested at the beginning of the project(not knowing it actually had a name, I just didn't know why we needed Entity beans since we were using stored procedures). But the then EJB "Expert" said we had to have Entity beans.
Thank you for your information.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com