Presumably you are using CMP.
My guess is that the client.getOrders().iterator() statement is getting a set of Primary Keys for the order.
As you progress through the iterator, each order in turn is loaded in a separate SQL statement.
So, for n orders, the application is making n+1 SQL operations.
You can prove this if you can turn on statement tracing in the database layer.
You will probably find that you need to go back to a direct JDBC call to get reasonable performance.
Entity Beans work best when the proportion of reads to writes is high.
So they work really well on reference data (order types, delivery methods, etc.), and work well on tasks like amending an order.
But they are not so helpful when, as in your example, you are reading a small portion of the underlying data and not referencing the data again.
Is it good programming pratice to mix and match EJB/CMP together along with JDBC in your application? For example use JDBC for most of my listing of for example clients orders etc.. and use entity beans to modify the orders, clients or at an order to the client etc.. Would this cause problems with the persisitence layer? Thanks for your input it is really appreciated.