Difference between Transfer objects and Domain objects

前端 未结 4 451
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-30 08:41

Could you please explain the difference between Transfer objects and Domain objects in simple terms ? And if u could give a Java example, that would be great..

4条回答
  •  粉色の甜心
    2021-01-30 09:38

    Transfer objects are often serializable due to the nature of its use, this is especially pertinent if the calls are remote and between JVM, or they will be used in a way that promotes serialization, such as stateful session beans. For this purpose, transfer objects must be susceptible to such "treatment", I.e. Transfer objects implement serializable.

    The reverse may not be said of domain objects. Domain objects may contain behavior, however DTO are merely a transportation medium.

提交回复
热议问题