cancel
Showing results for 
Search instead for 
Did you mean: 

global variables in message mappings - question:)

MichalKrawczyk
Active Contributor
0 Kudos

Hi,

I have a question about global variables in message mappings

can anyone confirm that they are global

for just <b>one</b> mapping instance? (I hope so)

or global for the whole one mapping?

I just need a confirmation as it's

not that easy to test the case

Regards,

michal

Accepted Solutions (1)

Accepted Solutions (1)

bhavesh_kantilal
Active Contributor
0 Kudos

Michal,

They are for one mapping instance only.

We had a requirement once when we wanted them to be initialized only once( global for whole mapping ), but we realised that global variables could not be used in such cases.

Regards,

Bhavesh

Answers (2)

Answers (2)

S0003485845
Contributor
0 Kudos

Hi,

If you have any of the Seeburger-Adapters in place, they provide this functionality with some Java-Classes and a database table (since this is a wide requirement in EDI, where you need to store specific transmission-counters for your different partners).

So you could copy the Java-Functions to your mappings.

Without these Adapters, I don´t know what the best way would be.

Greetings

Stefan

Former Member
0 Kudos

we keep an external db and update the table in a thread safe way !

STALANKI
Active Contributor
0 Kudos

Alternative way is to have a jar imported and have a java class final static variable:) and use it from UDF.:)

stefan_grube
Active Contributor
0 Kudos

Be careful. The mapping EJB is stateless. So you cannot be sure that two mappings are performed with the same bean. So you cannot tell, if a static variable is initial or has the value of any other mapping before.

It is better to avoid static variables in mapping.

Regards

Stefan

MichalKrawczyk
Active Contributor
0 Kudos

Hi Sravya,

but it's not the alternative:)

I need something which will be

instantiated just for one mapping

Regards,

michal