Use DTOs (data transfer object) - objects that are not entities, but are used to transfer data between applications / application layers.
There you have the freedom to decide which field is used when. For example:
class Service {
LoblessResult getSimpleData(..);
LobbedResult getCompleteData(..);
}
where LoblessResult and LobbedResult are two classes containing a different subset of the fields of your entity.
If the only difference is that @Lob field - then the client should make a second request to obtain the value of that field. You will have only one DTO, that has all-but-one fields.
发布评论
评论(1)
使用DTO(数据传输对象)——不是实体的对象,但用于在应用程序/应用程序层之间传输数据。
在那里您可以自由决定何时使用哪个字段。例如:
其中
LoblessResult
和LobbedResult
是两个类,其中包含实体字段的不同子集。如果唯一的区别是
@Lob
字段 - 那么客户端应该发出第二个请求来获取该字段的值。您将只有一个 DTO,其中包含除一个字段之外的所有字段。Use DTOs (data transfer object) - objects that are not entities, but are used to transfer data between applications / application layers.
There you have the freedom to decide which field is used when. For example:
where
LoblessResult
andLobbedResult
are two classes containing a different subset of the fields of your entity.If the only difference is that
@Lob
field - then the client should make a second request to obtain the value of that field. You will have only one DTO, that has all-but-one fields.