All lazy loads are triggered after the spring-data-jpa table entity is serialized.

< H2 > demand < / H2 >
what I want to do is to trigger (.size) lazily load all the data of the associated table when needed, do not load the data of the associated table when not needed, and do whatever I want.
< H2 > question < / H2 >

my table entity has many one-to-many, one-to-one relationships

user is one side (maintenance side specified by mappedBy)
order is multi-terminal

-sharp ordersuser,jackson.userorders@JsonIgnore
{
    user: {
        name: xxx,
        age: xxx,
    }
    orders: [
        id: xxxx,
        date: xxx
    ]
}
< H2 > the solution that comes to mind < / H2 >

add a conversion class to convert entities to map,list and then from jackson to json to return to the front end (a pile of compatibility problems and business problems)
spring data rest the control layer can return json to the front end that does not trigger lazy loading. (still does not change the status quo)

< H2 > I hope < / H2 >

there are better and more perfect ways.


does anyone know?

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e8c51d-10c7.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e8c51d-10c7.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?