I beg your pardon , if anybody knows what is the problem with my design.
the problem is for just a simple select statement to select 8 referral requests , it takes too much time to view them , i have turned the logging feature of eclipselink on to see what is really going on , i saw a huge logging lines appear for just simple retrieve of the referral requests .

i have attached my entities , screenshot of the page that views the retrieved requests and the logging output from eclipselink during running the system on my local host, i am using glassfish 3.1.1 , Spring 3.0 , primefaces and eclipselink as a persistence provider.

The problem is as follows , i have an object graph beginning with ReferralRequestEO that has a patient object , List of ReferralSpecialtyEO , Each ReferralSpecialtyEO has a workflowTransition "Active Transition" and history transitions "History of other workflowTransitions" , Now the problem is as follows .

When you select for example 10 requests , the DataTable not only views ReferralRequest details but also some information about the patient itself that is associated with the request. when the DataTable is about to render , for each referralRequest , there is a separate Query that is issued to get the patient just to view his/her information on the data table .

I did not have pagination on the dataTable , I was selecting the entire requests that are already existing in the DB that have specific Criteria , so if you have 400 Requests , you have 400 * 2 = 800 Individual queries to retrieve the results .

Now the glassfish has specific limited HTTP Grizzely Threads associated with it , When you have multiple simultaneous users accessing the system , you end up eating all grizzely threads on the glassfish and become unresponsive .

I think this is N+1 Problem that i am facing.

If you can help me by looking at my Entities Design and see if there is any single recommendation for me to do , i will appreciate that from you .