How are you using JBoss to expose the return data to your client?
Are you using the wsdl exposure system and a SOAP protocol?
Quote:
thus there's no need for the application to spend time serializing all those objects to my thick client
This indicates you are doing some sort of serialisation. Basically SOAP is dead slow when serialising data sets of a few hundred objects or so.
Table with 7 columns and 1100ish rows took 2 seconds to execute hibernate query and serialise/deserialise the data to a client using SOAP.
Roughly 250-300ms of that was in hibernate doing the query and generating the objects, the rest was SOAPing up and down, 1500ms+
The speed is generally linear so I would expect 2000 rows of similar size to take 3.5-4 seconds.
One BIG problem I found is the log4j system by default spews just about everything into a log file. I'm not entirely sure of the directory ( /server/<deploy_config/log/some_log_file I think ). If you haven't configured log4j.properties anywhere check in here for a massive log file. By default JBoss logs EVERYTHING including the content of all the SOAP traffic which imposes a huge overhead. This had the effect of making 2 second queries take 8-9 seconds before we found the problem.
So, more info would be handy, but I have had similar problems with JBoss appearing to have a massive speed impact on hibernate so I'd check for that log file being huge and if so scratch up a log4j.properties file with TRACE/DEBUG output disabled.
Posting your architecture, what JBoss is doing to the hibernate objects after they are created and the queries you are using plus table/schema info, would be helpful.
Good luck.
Myk.
P.S. I discarded JBoss in the end as 2 seconds for ~1000 records is too slow for my purposes, although it's the SOAPing that costs the time and JBoss does it as efficiently as other proprietory solutions I tried out.