A JPA entity class leaks a lot of implementation detail, for example that
you’re using JPA, what field maps to which database column, all sorts of mess.
A good API type doesn’t make this sort of decision, the implementation should
be free to use JPA, JDBC, Mongo, or whatever.
This is why it’s
Hi,
Agree, in past I tried to transfer JPA entities in JSON with
EclipseMoxy. It work's with simple object and link between entities but
you have to mix JPA and JSON in the same POJO and that is not good for
maintainability. It's better to separate.
François
François Papon
fpa...@apache.org
Le
In very simple cases it is possible to transfer JPA entities but it is not
a good practice to do so.
For a remote service it makes sense to have a separate DTO. Often you can
also tailor the DTO to the use case of the remote service. Like in the
service facade pattern.
Christian
Am Mo., 23.
Ok I found this as an example:
http://www.oracle.com/technetwork/java/transferobject-139757.html Thank you
--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
So if I get it right, I have theoretically two classes for Car, an entity Car
and a DTO Car. Both have same fields and getters/setters. and as next step I
use one class (instead of interface) car, that is used for both? Or is it
better to separate each implementation (jpa entity and data transfer
Hi,
you can use a similar design like in the takslist example:
https://github.com/cschneider/Karaf-Tutorial/tree/master/tasklist/tasklist-model/src/main/java/net/lr/tasklist/model
The Task class is a simple bean and also implements Serializable. Such
classes can be serialized with most
Hello,
I’m afraid that this isn’t the right way to design a remote service, nor is it
a particularly good way to design a service API.
When designing an API it is important to separate the functions of the API from
the data that those functions act upon and return. In this case you have
I have three bundles: an api bundle with simple interface Car (one attribute
"name") and a service interface with methods createCar and getCars. An jpa
bundle that implements these interfaces and a consumer bundle, that lists
the cars, when activated. When all bundles are in the same karaf