Answer the question
In order to leave comments, you need to log in
Why can there be a long response from the server in Spring REST Repositories?
Hello!
There is a Spring Boot application. Connected Spring Rest Repositories. The data is stored in a database (MySQL).
There are 2 entities:
Author {
@JsonIgnore
@OneToMany(mappedBy = "author")
List<Book> books = new ArrayList();
}
Book {
@JsonIgnore @ManyToOne
@JoinColumn(name = "author_id")
private Author author;
}
@Repository
public interface BookRepository extends JpaRepository<Book, Long> {
List<Book> findAllByAuthor(Author author);
Page<Book> findAllByAuthor(Author author, Pageable pageable);
}
spring.data.rest.basePath=/api
spring.data.rest.defaultPageSize=100
http://localhost:7777/api/authors/1/books
http://localhost:7777/api/cities/4/features
http://localhost:7777/api/cities/4/features?page=1
Hibernate: select city0_.city_id as city_id1_0_0_, city0_.city_iso_code as city_iso2_0_0_, city0_.city_name as city_nam3_0_0_, city0_.country_id as country_4_0_0_, country1_.country_id as country_1_1_1_, country1_.country_iso_code as country_2_1_1_, country1_.country_name as country_3_1_1_, country1_.map_link as map_link4_1_1_ from cities city0_ left outer join countries country1_ on city0_.country_id=country1_.country_id where city0_.city_id=?
Hibernate: select features0_.city_id as city_id6_4_0_, features0_.feature_id as feature_1_4_0_, features0_.feature_id as feature_1_4_1_, features0_.city_id as city_id6_4_1_, features0_.city_iso_code as city_iso2_4_1_, features0_.country_id as country_7_4_1_, features0_.country_iso_code as country_3_4_1_, features0_.type as type4_4_1_, features0_.wkt as wkt5_4_1_, country1_.country_id as country_1_1_2_, country1_.country_iso_code as country_2_1_2_, country1_.country_name as country_3_1_2_, country1_.map_link as map_link4_1_2_ from features features0_ left outer join countries country1_ on features0_.country_id=country1_.country_id where features0_.city_id=?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question