I develop a Java application with 4 tiers: database (MySQL), persistence (JPA), business (POJOs similar to stateless session beans in EJB), presentation (Java Swing).
I decided to fully decouple presentation and persistence tiers. So all modifications to all data are done through the business tier. This way the presentation tier does not even know that entity classes exist. This also allows a session bean to have a better control over the data passed, because sometimes a session bean needs to validate or convert values received from the presentation before changing the entities.
However, sometimes a session bean needs to send a big amount of information (like a list of entities with lots of properties) to a caller. And this becomes complicated because according to the design I adopted session bean needs to unwrap all those entities into something else. I tried to convert the list of entities into a list of arrays (where each member of an array correspond to a property in the entity), but this seems to be so flawed, error-prone and inefficient to me.
What would be the right way to send data over to the presentation? Does the concept of hiding the entities behind the session beans make any sense at all? What is the common pattern in such applications?