spring整合hib 4+4遇到的问题

来源:互联网 发布:linux服务器开发 epub 编辑:程序博客网 时间:2024/06/05 10:38


java.sql.SQLException: Field 'supplier_id' doesn't have a default value


改变行默认“”值即可



The database returned no natively generated identity value


在指定主键生成策略的时候、配置了<generator class="identity"/> 、这是提供自动增长、为数据表中的主键自动增长、但是如果数据库没有定义id列为自动增长的话、就会出现The database returned no natively generated identity value错误、所以要在数据库中手动定义id列自动增长

要么设置id自增长,要么把xml和实体里面的主键自增长的删除   我删除自增逐渐,后成功



java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory


加入common logging-1.2



org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [Application.xml]; nested exception is Java.lang.NoClassDefFoundError: org/aopalliance/aop/Advice


加入aopaliance

下载地址:http://central.maven.org/maven2/aopalliance/aopalliance/1.0/


最终遇到个问题,

Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'simpleCache' defined in class path resource [application.xml]: Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory


尝试过很多方法,最终整合失败

原因猜测是springrelease的包有的版本过旧,于是重新整合洗的版本,

spring4.2.4+hibernate 5.1.3


http://blog.csdn.net/qwe6112071/article/details/51013249  晚上参考

0 0
原创粉丝点击