cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a way to use EJBs directly inside WDJ without Model generation?

Former Member
0 Kudos

Hello,

Is there a way to use EJBs directly inside WDJ without Model generation, to avoid producing tonnes of code and reuse the JPA Entities?

Thanks

Sebastian

Edited by: Sebastian Lenk on Nov 3, 2010 7:01 PM

Accepted Solutions (0)

Answers (1)

Answers (1)

junwu
Active Contributor
0 Kudos

of course, you can.

it's pure java programming.

Context ctx = new InitialContext(); 
   Object o = ctx.lookup( 
"sap.com/HelloWorldEAR/REMOTE/HelloWorldBean/com.sap.sdn.ejb.HelloWorldRemote"); 
   HelloWorldRemote helloRef = (HelloWorldRemote)  
    PortableRemoteObject.narrow(o, HelloWorldRemote.class);

Former Member
0 Kudos

Thanks a lot. It rocks.

Are there any disadvantages using the EJB directly instead of the Web Dynpro Modelgeneration?

Best Regards

Sebastian

Former Member
0 Kudos

Hi Sebastian

One disadvantage is that you cannot bind a POJO to a context node. You need a model class for that.

It would be great to have a "POJO Binding" that works similar to the "Model Binding" but with plain java beans. But to my knowledge, there is no such thing.

Best regards

Tobias

rolf_paulsen
Active Participant
0 Kudos

BTW The method call narrow is not necessary in SAP NetWeaver.

It yields the object that is the first parameter (the result from lookup).

(of course this may change in furure implementations of lookup by SAP)