Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否可以重载 Hibernate POJO 以便将脏代码放在那里?为了清楚起见,我想将表单中的数据作为字符串传递,并对这些 POJO 进行所有解析和转换。或者有没有其他方法可以做到这一点?
谢谢
您可以使用 DTO 对象来表示表单中的数据,并对所有属性使用字符串。然后在服务器端,您可以使用静态类将 DTO 对象转换为 POJO,该 POJO 使用 Hibernate 映射到数据库。这样,您可以保持 POJO 的清洁。