I am trying to improve the performance of my ejb application and added to some finder methods the read-ahead flag, as mentioned in the jboss documentation.
To get around the transaction problem stated in the documentation I call from the client a session facade bean which does the call to the finder and converts the resulting collection into value objects which are passed back to the client.
Now I'm encountering an unstable behaviour of the read-ahead, which I cannot explain:
1. While profiling the sql calls I always see that the sql command
select <all cmp fields> from tblText where like 'TestText%'
This returns all fields of all records I'm interested in.
2. But sometimes, the first time after restarting the server, this call will be followed by sql calls to the individual beans.
This gives a big penalty to the performance ;-(
I double checked the xml files and cannot find something wrong, I reread the documentation too. But what I'm confused about is the fact that rehead works sometimes but never for a sql call to over 100 beans.
Has someone an explanation to this behaviour?