I am currently working on a distributed application using the following components:
1.tier: Database-Server -> MySQL 5.5
2.tier: Application-Server -> Glassfish 3.1.2.2
3.tier: Stand-alone Fat-Client -> Java-SE (JRE 6)
I use JPA 2.0 (eclipse-link) as persistence provider and currently passing the @Entity beans between the 2nd and 3rd tier using serialization. I use static weaving in order to benefit from lazy fetching supported by JPA.
My problem is, that because of serialization between 2nd/3rd tier lazy fetching won't work! That results in heavy network traffic, since every serialization of one of my entity beans requires that all relationships to other entities/tables are fetched before sent over the network.
How can I benefit from JPA lazy fetching in such a setup? Is there a work-around without the need to introduce leightweight DTO/DAO (this would add huge complexity to my project) ?
Many thanks for your help in advance!