我在这里关注 spring.io 博客:https://spring.io/blog/2018/09/24/spring-data-jdbc-references-and-aggregates
并在此处有一个带有 Book 和 Author 实体的示例 SpringBoot 应用程序:https ://github.com/b-sridhar/spring-data-jdbc-example 。
我收到以下错误:No value supplied for the SQL parameter 'demobook': No value registered for key 'demobook'
在调试时注意到执行的 SQL 查询是:INSERT INTO demo.book_author (author, demo.book) VALUES (:author, :demobook)
which should have been INSERT INTO demo.book_author (author, book) VALUES (:author, :book)
. 发生这种情况是因为我有@Table("demo.book")
作为Book
实体的注释。如果我删除demo
表名中的模式,那么测试就BookAndAuthorsTests
可以通过了。
如何设置schema
表Book
?