Persistence web service for rich client Java (swing) applications

I am using NetBeans RCP rich client to rewrite my client server rich client database application (swing) into a three-tier application

By default, hibernate and other JPA providers can only use rich clients in a very cumbersome way (the native database connection will not cut off the firewall, lose delayed loading, manage the session / entitymanager life cycle, etc.) Therefore, some kind of extension is needed to easily use them in rich clients

Typically, rich clients invoke Web services in the business logic layer (on the server) Typically, dedicated web service methods handle CRUD operations for each object type Now, I don't want to write a custom web service for CRUD operations of each persistent class of my application, so I think there may be a general persistent web service that can handle CRUD operations of at least all types of operational applications

Is there such a persistent service???

Here are the details of my ideas / requirements:

This service should be used with JPA annotated POJOs, so it should use some JPA persistence provider on the server At present, I am using hibernate, so if it actively supports hibernate, it is an advantage Of course, the POJO class must be included in the server-side JPA configuration. I don't want to deal with any unknown POJO

I don't want to create separate value objects or data transfer objects to send data between the client and server parts of the service I want to use only JPA annotated POJOs for transfer I believe this is the standard practice now

The client should receive data and send the data with HTTP request to the server of the service to reduce firewall communication problems HTTP proxy usage should be configurable

The client of the persistence service can obtain the POJO list results of the JPA QL query executed by it (sent as a simple query string, optionally * * also send the named parameters * * in the request) These queries are sent from the client to the servlet in the form of a web service call or a simple HTTP request It would be nice if you could send several JPA queries in one request The client receives the result of the request as a list of POJOs, which may have delayed loaded collections and object references (which are not sent from the server during query)

When the client application accesses the deferred load attribute in the POJO (at a later point in time rather than in the initial query), the client of the persistence service should be able to automatically / transparently execute the deferred load request Therefore, transparent deferred loading should still be valid after the POJO is transferred to the client

A new, updated / dirty or to be deleted POJO can be sent to the server by the client of the persistence service, where the change is persisted and the success / failure status is sent back (for example, give a new persistent ID) POJO) You can send several POJOs to be saved in one request

It should have a mechanism to mark the transaction boundary, so it can execute multiple independent HTTP service calls in a database transaction (similar to session / entitymanager. Begintransaction(), commit() and rollback())

It would be nice if authentication and access control checks could be inserted into the server components

Is there such a persistent service? What extensions might come with JPA persistence providers?

Solution

When I designed a similar application in 2002, we searched a framework for use, but eventually had to run our own

You may want to use JDO 2.0 as a persistence layer It supports separating objects or subtrees from the persistent object graph, sending these separated objects over the line, and reattaching them in future transactions

However, you cannot minimize data sent over the line

The best choice so far: run your own mechanism and add the createdto and updatefromdto methods to the persistent object, but I'm glad it turned out to be wrong

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>