cancel
Showing results for 
Search instead for 
Did you mean: 

How-to use IWDDynamicRfcModel.setConnectionProvider()

Former Member
0 Kudos

Friends,

I have an application that uses a few models. As far as I understand each model receives an instance of JCO.

I have been advised in this forum to use

IWDDynamicRfcModel.setConnectionProvider() to tie up

all JCO instances into one. Unfortunately I do not know how to use this method.

Any insight will be highly appreciated

Humbly,

yuval peery

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello Peery,

// two separate model instances are created ...

MyFirstModelTypemodelMyFirst=

(MyFirstModelType) WDModelFactory.getModelInstance(

MyFirstModelType.class,WDModelScopeType.APPLICATION_SCOPE);

MyOtherModelTypemodelMyOther=

(MyOtherModelType) WDModelFactory.getModelInstance(

MyOtherModelType.class,WDModelScopeType.APPLICATION_SCOPE);

// ... but the first model manages and provides the

// connection for the other model

modelMyOther.setConnectionProvider(modelMyFirst);

regards,

Sumit Malhotra

Award points if it useful to you.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Yuval,

assume you have two models, ModelA and ModelB, and two corresponding instances, instA and instB.

instA.modelInstance().setConnectionProvider(instB.modelInstance());

Pay attention to few things:

  • If instB goes out of scope, you will get connection errors when trying to execute instA.

  • By default each model has an application scope. This means that if you create more instance of ModelA they share the same connections (so the above statement is not required). This also mean that the above statement influence every model of type ModelA that you create, not only instA.