Dear sunil,
We cannot optimise your code, since we don't have it.
1) Add print statements to the code to see what operation takes up so much time. Also, count the number of database accesses you perform.
2) Ask yourself: am I doing stuff in
Java code that I should let Oracle do? For example this is wrong:
And this is right:
In general, let the database do operations on sets and collections and let Java do operations on individual entities. That way, you use the strengths of each.