When you call a remote service (for example, over RMI) to load a list of entities from a database using Hibernate, how do you manage it to initialize all the fields and links the client needs?
Example. The client calls the remote method to load all clients. With each client, the client wants the link to the list of purchased goods of the client to be initialized.
I can imagine the following solutions:
Write a remote method for each special request that initializes the required fields (for example, Hibernate.initialize ()) and returns domain objects to the client.
Like 1. but create a DTO
Divide the query into multiple queries, for example. one for customers, the second for customer articles and allows the customer to manage results.
The remote method uses DetachedCriteria, which is created by the client and executed by the server
Develop a custom "Preload-Pattern", that is, a way for the client to explicitly specify which properties should be preloaded.
java hibernate remoting rmi
cretzel
source share