cancel
Showing results for 
Search instead for 
Did you mean: 

Creation Code EJB

Former Member
0 Kudos

Dear all,

is it possible to let Developer studio create the code for calling an ejb automatically?

the following code is actually always the same and it's not practical to type that code over and over again every time we want to call a method on an EJB...


InitialContext ctx = new InitialContext();
		TestEJBLocalHome localHome = (TestEJBLocalHome)ctx.lookup("localejbs/TestEJBBean");
		TestEJBLocal bean = localHome.create();

So it would be nice if there was a way to say to developer studio, this is the bean i want to use, please generate the code so i can call my method on it.

Kind regards,

J.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Joren,

Almost exactly what you need:

1. In NW IDE open Window -> Preferences

2. Navigate to Java -> Editor -> Templates

Got the idea?

Valery Silaev

SaM Solutions

http://www.sam-solutions.net

Former Member
0 Kudos

Hi Joren,

What ur asking is specific to one EJB and in real time u don't make use of the same EJB always. as per my knowledge there is no option from sap IDE ,

but you can edit the default comments and put these statements for java class

creation. but it is not good programing practice

Regards

PP

Former Member
0 Kudos

Hello,

Thx for the replies. I know its not always the same EJB that will be used, but it would be a nice feature in the developer studio ( @ design time ) that one could generate the code from a specific EJB. NWDS would know the specific data then, because the EJB to create the code for is selected...

Kind regards,

J.

Former Member
0 Kudos

hi Joren,

as per my knowledge sap doesn't provided such an option till now and even there is no hope such an option will be provided in the near future

regards

PP

Former Member
0 Kudos

Hi Joren,

No, there is no short cut to generate these three lines of code.

You will have to type in these three lines..

If u find some method to get the lines pls. do inform me.

Thanx & Regards.

Alka