spring-boot - 迁移中 hibernate.hbm2ddl.auto 的问题
问题描述
我已经将一个 spring-boot 项目从 MySQL 迁移到 SQL Server。我没有必要的角色来使用 hibernate.hbm2ddl.auto = update。如何在没有系统管理员访问权限的情况下进行更新?
我需要更新,因为我不能丢失记录
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]
解决方案
我不知道您是如何调用 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
推荐阅读
- python - 如何从列表中删除相似的字典并获得单个值?
- azure - 无法在 Azure 中使用 ServicePrincipal 凭据获取应用程序
- java - 将字符串值设置为 MPAndroidChart 条形图的 xaxis 标签
- c# - 无法加载文件或程序集“Microsoft.Build.Utilities.Core,版本=14.0.0.0,文化=中性,PublicKeyToken=b03f5f7f11d50a3a”
- c++ - C++:如何使我的计算程序的每个答案都对齐?
- javascript - 什么样的 JS 数据结构内部代表?
- c# - Httpclient 下载时获取实时下载速度
- powershell - 如何在 powershell 中传输 ETX 命令?
- runtime-error - [15896] ReportWifiNetworkData.exe 中出现未处理的异常('System.BadImageFormatException')
- java - 嗨,我想用 thyleaf 填充选择的 html 并出现错误