【发布时间】:2015-04-29 01:46:26
【问题描述】:
我有一个在 Spring Web MVC 中使用 Spring Data JPA 和 REST 控制器的解决方案。持久性提供程序是 Hibernate。
持久层是使用 Spring Repositories 构建的,在 de REST Controller 和 repository 之间存在一个 Service Layer:
Entity <--> Repository <--> Service <--> Controller
在实体级别,我有 FetchType = LAZY 的 @OneToMany 字段。
当 REST 控制器进行序列化时,会进行提取,但在某些情况下这是不可取的。
我已经尝试过使用@JSONInclude Jackson 注释并且序列化仍然发生。
有人可以帮我提供一个经过验证的解决方案吗?
【问题讨论】:
-
查看您可能感兴趣的以下内容:stackoverflow.com/questions/28447922/…
标签: spring hibernate spring-mvc jpa spring-data