【发布时间】:2015-05-13 15:03:08
【问题描述】:
我正在尝试在 Spring Boot 应用程序中将 Spring Social 集成到 Spring Security 之上。但似乎 Spring Security 在创建默认表时遇到了问题,例如UserConnection、UserProfile 等,因为在成功建立与 oauth2 提供程序的连接后出现这些 SQL 错误:
PreparedStatementCallback; bad SQL grammar [select userId from UserConnection where providerId = ? and providerUserId = ?]; nested exception is org.h2.jdbc.JdbcSQLException: Tabelle "USERCONNECTION" nicht gefunden Table "USERCONNECTION" not found; SQL statement: select userId from UserConnection where providerId = ? and providerUserId = ? [42102-185]
这是 spring 提供的 JdbcUsersConnectionRepository 中的静态 SQL 调用。我试图切换到避免 SQL 问题的 InMemory 实现,但接下来发生了:
PreparedStatementCallback; bad SQL grammar [INSERT into userProfile(userId, email, firstName, lastName, name, username) values(?,?,?,?,?,?)]; nested exception is org.h2.jdbc.JdbcSQLException: Tabelle "USERPROFILE" nicht gefunden Table "USERPROFILE" not found; SQL statement: INSERT into userProfile(userId, email, firstName, lastName, name, username) values(?,?,?,?,?,?) [42102-185]
USERPROFILE 表也丢失了。
在我发布大量配置 sn-ps 之前,您是否已经知道一些我可能忘记的东西,它告诉 spring 为我创建这些表? :)
目前我正在使用 Spring Boot 标准 H2 内存数据库,它与 JpaRepositories 配合得很好。
谢谢! :)
【问题讨论】:
-
我按照本教程 goo.gl/qAxitC 得到它的工作 - 但我在将这个 sql 转换为类实体时遇到了问题。 spring 要我创建所有表而不是这两个
标签: spring spring-security spring-social-google