I am rewriting my client server client application (Swing) into a three-tier application with rich NetBeans RCP client.
By default, Hibernate and other JPA providers can only be used in a very cumbersome way from rich clients (own database connection that does not cut through firewalls, loss of lazy load, conceptual problems with Session / EntityManager lifecycle management ... etc. others Problems). So you need some kind of extension to conveniently use them with wealthy customers.
Wealthy clients usually call webservices at the level of business logic (on the server). Typically, dedicated web service methods handle the CRUD operations of each type of object. Now I would not want to write my own web service for CRUD operations of each constant class of my application, so I thought that there could be a generic persistence web service for operations that can handle at least all CRUD operations of the application.
Is there such a save service?
Below are the details of my ideas / requirements:
The service should work with JPA-annotated POJOs , so the server must have some support for JPA-resilience. I am currently using Hibernate, so if it actively supports Hibernate, this is a plus. Of course, POJO classes should be included in the server-side JPA configuration, I do not expect ANY kind of unknown POJOs to be processed.
I would not like to create separate Value Objects or data transfer objects for sending data between client and server parts of the service. I would like to use only JPA-annotated POJOs even for transmission . I think this is standard practice these days.
The client should receive data and send data with HTTP requests to the server service in order to reduce communication problems with the firewall. Using an HTTP proxy must be customizable.
The client part of the save service can receive POJO list results for completed JPA QL requests (sent as a simple string , optional ** named parameters ** also sent in the request). These requests are sent by the client in the form of a webservice call or a simple HTTP request to a servlet . It would be nice if several JPA requests could be sent on one request, the Client receives the result of the requests in the form of POJO lists, which can have lazy loaded collections and links to objects (they are not sent from the server during the request).
Customer service data storage services should perform lazy load requests automatically / transparently when the client application accesses the lazy-load attribute in the POJO (later, and not in the original request). Thus, transparent lazy loading should remain operational after the POJO has been passed to the client .
New, updated / dirty or to be deleted POJOs can be sent by the client by the save service side to the server, where the changes are saved and the success / failure status is sent back (for example, the identifier that was assigned by the newly saved POJO). Multiple POJOs to be stored can be sent on one request.
It should have a mechanism for marking the boundaries of the transaction , so several independent calls to the HTTP service can be made in a single database transaction (saving something like Session / EntityManager. BeginTransaction () , commit () and rollback ()).
It would be nice if validation and access control checks can be connected to the server component.
Is there such a conservation service project? Perhaps as an extension shipped with the JPA continuity provider?