我跟着https://developers.google.com/web-toolkit/articles/mvp-architecture。 在他们的模型中,他们使用一个类'Contact'和一个名为'ContactDetails'的轻类型。 因为我不需要轻量版本,所以我删除了ContactDetails并将其替换为Contact。避免使用DTO类?
现在我遇到的异常像
Type 'org.eclipse.persistence.indirection.IndirectList' was not included in the set of types which can be serialized by this SerializationPolicy or its Class object could not be loaded. For security purposes, this type will not be serialized.: instance = {IndirectList: not instantiated}
的原因是,因为我发现在这里(http://stackoverflow.com/a/6778986/1141785),该联系类是一类使用持久性API技术,不应该发送到电线。
那么ContactDetails类是我应该通过电线发送的DTO类吗? 有没有办法避免使用这个额外的类?
我想避免使用'light'版本的原因是,我想使用FieldUpdater编辑DataGrid中的Contact类。
当我使用DTO课程时,我有什么优势吗?
我该如何避免在Contact和ContactDetails类中有这么多重复的代码?
有关于这一主题的专文:https://developers.google.com/web-toolkit/articles/using_gwt_with_hibernate(但要注意,基列不再是一个活跃的项目) –
我没有看过这篇文章,因为它是关于休眠。但是,当你遇到相同的问题时,使用JPA时也值得阅读!谢谢! – user1141785