【Postopia Dev Log】Week 7

过去一个月一直在忙各种课程作业,直到分布式数据库的课用到了Postopia

需要实现评论获取,先使用简单方式实现两层评论的获取,后续需要优化

喜欢,反对的逻辑有问题,需要修正

Default Fetch Types

@OneToMany: Lazy by default.

@ManyToOne: Eager by default.

@OneToOne: Eager by default.

@ManyToMany: Lazy by default.

Sort.Direction

而不是String,否则会出错

@arams

‘Name for argument of type [java.lang.Long] not specified, and parameter name information not available via reflection. Ensure that the compiler uses the ‘-parameters’ flag.’

This error in a Spring Boot application indicates that Spring Data JPA is unable to map the parameters in your repository method to the query because it cannot retrieve parameter names through reflection.

By default, Java does not retain method parameter names in the compiled bytecode unless you explicitly instruct the compiler to do so using the -parameters flag.

Spring relies on parameter names to match method parameters to query parameters (e.g., @Param("id") in a query). If it cannot retrieve the parameter names, it throws this error.

Licensed under CC BY-NC-SA 4.0
Last updated on Nov 17, 2024 00:00 UTC
comments powered by Disqus
Built with Hugo
Theme Stack designed by Jimmy