java - 在 Spring Boot 中膨胀实体中的内部类
问题描述
我有实体和连接的 JPA 存储库。我需要初始化主对象,它对我有用,但我不能膨胀主实体中的内部对象。例如:
SQL:
select id, latitude, longitude from user where id = 1;
结构:
@Entity
@Table(name="user")
class User {
@Id
Integer id;
Location location = new Location();
public static class Location {
@Column(name="latitude")
double latitude;
@Column(name="longitude")
double longitude;
}
}
解决方案
推荐阅读
- javascript - Webpack-CLI 错误:配置对象无效
- ms-access - 访问 - 基于另一个表返回员工列表的最佳方式
- google-sheets - Google表格:如何从两个匹配的列中设置值?
- hibernate - Spring Data JPA 不可变实体
- kubernetes - 印花布`套接字错误:绑定:Gitlab kube runner 作业后地址不可用`
- reactjs - 在 Material UI 自动完成上显示一个值(而不是标签)
- terraform - Terraform v0.13 - 检查是否提供了密码或密码,如果没有,则使用随机生成的密码
- google-apps-script - 如何使用脚本从谷歌工作表中删除除最后 2 行之外的所有行?
- list - 用户更改 word 文档内容属性数据时更新 SharePoint 列表
- gradle - Intellij Idea - 如何将其他 gradle 项目添加为依赖项以立即反映依赖项目中的更改