Controller中的Tune方法。 [PersistenceUnit:default]无法构建Hibernate SessionFactory [英] Tune method in Controller. [PersistenceUnit: default] Unable to build Hibernate SessionFactory
问题描述
如何实现这个想法?
发送信息:{idBanner:2,fullnameClient:Aria}。
如果单击不包含在数据库中,则单击保存并发送电子邮件businesscenter。否则,发送一条消息:你回应了。
错误可能是版本依赖?
(实体):点击绑定横幅,横幅绑定Businesscentr。
how to realize the idea? Send me information: {"idBanner":2, "fullnameClient":"Aria"}. If click don't contain in database, then click save and send email businesscenter. Else, send a message: "you responsed". Error maybe version dependences? (Entity) : Click bind Banner, Banner bind Businesscentr.
推荐答案
架构验证:列错误在表[banner]中的列[id_bc]中遇到的类型;找到[int(类型#INTEGER)],但期待[bigint(类型#BIGINT)]
这是导致此问题的问题
堆栈跟踪提到hibernate正在验证你的架构,它找到错误的列类型,这发生在 hibernate.hbm2ddl.auto = validate ,
Stack trace it is mention that hibernate is validating your schema where it is finding wrong column type, this happen when hibernate.hbm2ddl.auto = validate ,
现在你可以保留这个属性hibernate.hbm2ddl.auto = update,这样它就会更新你实体所做的更改,
Now you can keep this property hibernate.hbm2ddl.auto = update , so that it will update the changes made in your entities,
或者只是更改数据库模式,并将此列的类型设置为大整数,就像在您使用的实体中一样。
or just change your database schema and make the type of this column as big integer, as in your entities you are using long.
此外,不需要在使用 hibernate.hbm2ddl.auto = update 时重新创建数据库。在这种情况下,hibernate不会验证您的模式。
Also, no need to recreate database when you are using hibernate.hbm2ddl.auto = update hibernate won't validate your schema in this case.
谢谢。
这篇关于Controller中的Tune方法。 [PersistenceUnit:default]无法构建Hibernate SessionFactory的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!