我已经将一个spring-boot项目从MySQL迁移到SQL Server。我没有必要的角色来使用hibernate.hbm2ddl.auto = update。在没有sysadmin访问权限的情况下如何更新?
我需要更新,因为我不能丢失记录
2021-07-21 | 13:30:17.660 | INFO | main | o.h.t.h.SchemaUpdate | HHH000228: Running hbm2ddl schema update
2021-07-21 | 13:30:17.692 | WARN | main | .e.j.s.SqlExceptionHelper | SQL Error: 229, SQLState: S0005
2021-07-21 | 13:30:17.692 | ERROR | main | .e.j.s.SqlExceptionHelper | The SELECT permission was denied on the object 'sequences', database 'mssqlsystemresource', schema 'sys'.
2021-07-21 | 13:30:17.692 | WARN | main | ddedWebApplicationContext | Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory
2021-07-21 | 13:30:17.692 | INFO | main | o.a.c.c.StandardService | Stopping service [Tomcat]
发布于 2021-07-26 23:45:49
我不知道您是如何调用hbm2ddl的,但是您可以指定一个输出文件,然后手动应用这些语句。您可以通过javax.persistence.schema-generation.scripts.create-target
参数进行配置。详细信息请参阅文档:https://docs.jboss.org/hibernate/orm/5.5/userguide/html_single/Hibernate_User_Guide.html#configurations-hbmddl
https://stackoverflow.com/questions/68498174
复制相似问题