ssh框架下,外键约束问题

版权声明:转就转吧~~记得声明噢~~ https://blog.csdn.net/Soul_97/article/details/85141200

严重: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager' defined in class path resource [applicationContext.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; 
nested exception is org.hibernate.tool.schema.spi.SchemaManagementException: Unable to execute schema management to JDBC target [alter table cst_customer add constraint FKeh5g36duab8g1h051pdjfwcgd foreign key (cust_source) references base_dict (dict_id)]
 

找了半天的错,看了好几遍配置文件和相关的代码,发现都没有问题,但是tomcat跑起来依然报错

解决方案:

这是由于外键约束的锅,表是之前的表,不过约束改变了,需要把数据库下相关的表都删了,然后让Hibernate自动生成表,这样外键约束就对了。

猜你喜欢

转载自blog.csdn.net/Soul_97/article/details/85141200