cancel
Showing results for 
Search instead for 
Did you mean: 

Using EJB as model

Former Member
0 Kudos

hi all,

i am new to Java Webdynpros.

I want to work on EJB as model.

Please can anyone give an example/ step by step using EJB as model in NWDS.

Regards,

Somya

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

You cannot directly use a EJB as a model in Dynpro. You will have to use a Java Bean model.

To use EJB's you will have to create a Command Bean based on the EJB and then import the Command Bean as a Java Bean Model.

Thanks,

GLM

Answers (7)

Answers (7)

Former Member
0 Kudos

Thaks for the Help

siddharth_jain
Active Contributor
0 Kudos

Hi,

For using EJB as a model in Webdynpro for NW2004s you can follow the below mentioned steps these steps applies to your local development and if you are working in NWDI then these steps will require some modifications:---

1.)create an EJB project in NWDS choose stateless session bean and write your business logic in the EJB,You can also use entity session bean for persistence in your project and generate the EJB jar file.

2) Create a simple java project, create a java bean class..

in this java bean class you will lookup Remote or Local interfaces of the EJB by its JNDI name and you will get the local or remote instance of the EJB. Then you have to create getter and setter methods in the Bean for setting and getting the values in the EJB methods. these methods will act as a wrapper over the EJB methods.

3.)Next step will be generating the jar file of the command bean. You can generate the jar files by doing the following steps:

--Switch to the Navigator view and select your Bean Project. From the context menu, choose Export as Jar File and choose Next.

--Choose the Browse button, navigate to your Bean project, and enter .jar in the Name field. Choose Save and then Finish.

4)After this you have to copy the bean Project jar file and EJB project jar file in Lib folder of your Webdynpro application this is necessary because by doing this EJB and Command bean will be deployed on server and EAR project will not be necessary than.

5.) Now to consume the EJB in Webdynpro you have to create the Java bean model and the bean class will be available

to access your EJB.

these steps are mentioned with an example in the below mentioned link:--

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/1f5f3366-0401-0010-d6b0-e85a49e9...

Pls award points for an helpfull answer.

Regards,

Siddharth J.

Former Member
0 Kudos

Hi,

1) create an ejb module Development Component[DC]

2) apply a stateless session bean, implement your business logic and add the methods

to the local interface

3) right click your ejb DC and select Development Component > Show In > Component Properties from context menu

- switch to the permissions tab and select Entity forwarding

4) create a Java EE Enterprise Application Archive (ear) file and reference your ejb

5) right click your ear DC and select Development Component > Show In > Component Porperties from context menu

- switch to the Public Parts tab

- add a new puplic part (compilation)

- right click it, select Reference Entities from the context menu and browse for your ejb DC and choose the Client public part

4) create WebDynpro DC

5) import your ejb

Hope this will work

Regards,

Martin

Former Member
0 Kudos

hi ,

Try this,

Former Member
0 Kudos

Hi,

U may also try the phone book application

Accessing database table using EJB and web dynpro

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/70929198-0d36-2b10-04b8-84d90fa3...

Former Member
0 Kudos

Hi Somya,

for this u'll hav to create j2ee project for java beans then java project for wrapper class thn u'll hav to create Ear n atlast webdynpro project.

Here is d link for one sample application which shows steps for

Webdyn pro project using ejb ..

link:[https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/1f5f3366-0401-0010-d6b0-e85a49e93a5c]

Regards,

Khushboo

Former Member
0 Kudos

Yes -- EJB as a model is possible ONLY IN CE 7.1

Former Member
0 Kudos

Hi somya,

You Can use EJB Model in java Dynpros, Refer to these links you will find all The Process for Developing an application using EJB's.

[Importing Enterprise JavaBean (EJB) Models|http://help.sap.com/saphelp_nwce10/helpdata/en/45/dd45e4bc295595e10000000a1553f7/content.htm]

[Enterprise JavaBeans for Web Dynpro|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/20b21892-c31c-2a10-f484-fcef1eaf8c4f]

[SAP NetWeaver J2EE Preview: Application Development with the EJB 3.0 Programming Model|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/0914ef0d-0d01-0010-beb9-d85ef5a6188d]

I Hope This Information might be Helpful for you.

Regards,

Sharma.