cancel
Showing results for 
Search instead for 
Did you mean: 

Java Mapping: Caching Objects

Former Member
0 Kudos

Hello,

I have written a Java Mapping which needs to access lookup data stored in an external database.

I would like to cache the lookup data.

To get this running, I have declared static String tables and carried out the DB access in a static initialization block.

Once I test the mapping in integration builder design, I can see in the trace that my mapping class is reloaded( and the static initialization redone ) each time I run the test.

I am now struggling on whether the classloading for each test is a feature of the test framework?

Another point is, that I would like to do the database access and the caching of my lookup objects at system start and not on the first processing of a message mapping (very easy to be done in SAP Business Connector). Is there a way to do this in XI?

Thanks

Matthias

Accepted Solutions (1)

Accepted Solutions (1)

former_member184154
Active Contributor
0 Kudos

Hi Matthias,

> I am now struggling on whether the classloading for

> each test is a feature of the test framework?

Very empiric, but I would try to send a message twice at runtime, log your static init somewhere (Trace Object) and check it out.

> Another point is, that I would like to do the

> database access and the caching of my lookup objects

> at system start and not on the first processing of a

> message mapping (very easy to be done in SAP Business

> Connector). Is there a way to do this in XI?

No easy way without touching the <i>delicate</i> J2EE machine.

And, yes, I agree: BC is still great for certain aspects!

Alex

Message was edited by: Alessandro Guarneri

Answers (2)

Answers (2)

Andrzej_Filusz
Contributor
0 Kudos

Hi!!!

In XI 2.0 your java mapping class is reloaded for every message processing.

Fortunately, in XI 3.0 this behaviour was changed. Now a class is not reloaded when a message arrives, so it's possible to create your own cache - I tested it and it works.

Regards,

Andrzej

Former Member
0 Kudos

Thanks for your input Andrzej

Matthias

Former Member
0 Kudos

Thanks Alex,

than my idea would be to create a little statless session ejb which performs all the DB access, caching, refresh etc.

This ejb would than be called from my java mapping for lookup requests?

Regards

Matthias

former_member184154
Active Contributor
0 Kudos

Yes, should work as you say.

Only suggestion I may give you is to use Netweaver Developer Studio to build and deploy your EJB: it's just outstanding in terms of easiness of connection to the SAP J2EE machine.

regards,

Alex

Former Member
0 Kudos

Thanks Alex,

I work in Netweaver Developer Studio only thing I dont like there is the lack of CVS.

Matthias