on 04-10-2007 2:12 PM
Hi
I've a table in MS SQL database. I've created in Visual Admin, the datasource(jdbc/MyAlias) for the above. SQL Server has Employee Table with EmpId, FirstName, LastName and Description as its Columns.
I want to display, modify , insert and delete entries from the Employee Table using web Dynpro. For this we have used JDBC method by which we create class file which will have JDBC connectivity and logic for getting data from backend. This class file then used for display, update and other operations. And the context is built at design time.
This is not proper method, as this doesn't come under perview of MVC concept.
I want to use EJB Models for this case. But I'm stuck with some problems.
1. How do I implement EJB models in this scenario.
2. How do EJB module (entity bean) connects to external database.
3. What are the most logical steps to be used in this case.
Any pointers for this will greatly appreciated with points?
So far I was able to do create EJB module of Entity Bean type with all interfaces. But beyond this I'm not able to proceed. Do let me know the step wise procedure for this kind of scenario.
Thanks
Srikant
Hi ,
For a simple empid , first name and last name application it would not make sense to make use of a entity bean.. Entity bean offer persistent storage of data.. and I would use it only when it represents Business data which is quite often used..
In case of simple applications , it would make sense to use just a java bean !
For entity beans , refer this <a href="http://www.informit.com/articles/article.asp?p=100598&seqNum=2&rl=1">page.</a>
Regards
Bharathwaj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Srikant,
Please gothrough this link,
https://www.sdn.sap.com/irj/sdn/downloaditem?rid=/webcontent/uuid/a11ba7c8-0401-0010-23b5-f5d2394c0a... [original link is broken]
Regards,
Ramganesan K.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ,
Please go through this link
https://www.sdn.sap.com/irj/sdn/downloaditem?rid=/webcontent/uuid/a11ba7c8-0401-0010-23b5-f5d2394c0a... [original link is broken]
Thanks,
Balaji
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Srikant,
I have worked on similar stuff, but the scenario was a little different. I worked on creating Web Services using EJBs, but the basic part was that, the web service was supposed to interact with the SQL Server database. So maybe I can help you...
First thing which is needed is that you have created the JDBC Connector in your Visual Administrator correctly. If you wish to cross check, you can see my answer in the following thread:
In this thread itself I have given the code which is the solution to your problem (this is what i believe). I am pasting the code again:
<b>InitialContext initialContext = new InitialContext();
DataSource dataSource = (DataSource)initialContext.lookup("jdbc/MyAlias");
java.sql.Connection connection = dataSource.getConnection();</b>
You can use this code in the method of your EJB, and then you can easily use this connection object to access your database tables using SQL queries.
And if by any chance you are looking for a step wise procedure for creating a web service from an EJB, then give me your email address, i will send you the doc.
Bye
Ankur
Do reward points if it helps!!
User | Count |
---|---|
95 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.