首页 > 解决方案 > 在 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;
    }
}

标签: javaspringspring-bootspring-data-jpaspring-data

解决方案


推荐阅读