我正在处理一个春季批处理项目,我使用了server作为本地数据库,使用这个链接为批处理创建db脚本,但现在却低于给定的错误。
23463 [main] WARN o.s.b.c.c.a.DefaultBatchConfigurer - No transaction manager was provided, using a DataSourceTransactionManager
24014 [main] WARN o.s.b.a.o.j.JpaBaseConfiguration$JpaWebConfiguration - spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
92338 [HikariPool-2 housekeeper] WARN com.zaxxer.hikari.pool.HikariPool - HikariPool-2 - Thread starvation or clock leap detected (housekeeper delta=49s173ms145µs619ns).
102416 [HikariPool-1 housekeeper] WARN com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Thread starvation or clock leap detected (housekeeper delta=1m969ms212µs331ns).
102682 [http-nio-8080-exec-1] ERROR o.a.c.c.C.[.[.[.[dispatcherServlet] - Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.dao.DataAccessResourceFailureException: Could not obtain sequence value; nested exception is com.microsoft.sqlserver.jdbc.SQLServerException: Object 'BATCH_JOB_SEQ' is not a sequence object.] with root cause
com.microsoft.sqlserver.jdbc.SQLServerException: Object 'BATCH_JOB_SEQ' is not a sequence object.当我调用SQL查询时
SELECT name, type_desc FROM sys.objects WHERE name=N'BATCH_JOB_SEQ';返回的结果是
Name: type_desc:
BATCH_JOB_SEQ SEQUENCE_OBJECT发布于 2022-11-10 05:18:15
在Spring 4中,使用表来模拟Server的序列,使用SqlServerMaxValueIncrementer来增加ID。
在Spring v5中,我们将Server支持更改为使用序列,而不是使用表来模拟它们。版本5使用SqlServerSequenceMaxValueIncrementer来增加ID。
您共享的链接指向main分支的DDL脚本,该脚本用于Spring v5。因此,在您的示例中,您要么需要为v4使用DDL脚本(可以找到这里),要么需要将应用程序升级到Spring 5(最后一个版本是5.0.0-RC2,GA计划在2022年11月晚些时候发布)。
https://stackoverflow.com/questions/74384100
复制相似问题