![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
spring异常处理
evolution_language
这个作者很懒,什么都没留下…
展开
-
was altered from xxx to null; nested exception is org.hibernate.HibernateException
was altered from xxxto null; nested exception is org.hibernate.HibernateException直接上干货:在使用JPA时 如果使用的保存方法在保存数据库已存在的对象时,而这时你将数据库的已存在的数据传过来并使其主键id为null 这时如果调用JPA的修改方法就出出现这个错误 .解决办法 在一个事务中当使其主键id为null调用JPA自带的save方法而不是update方法...原创 2021-11-05 09:32:54 · 2950 阅读 · 1 评论 -
org.hibernate.HibernateException: identifier of an instance 错误可能出现的情况
最近在使用hibernate jpa中出现了该错误org.hibernate.HibernateException: identifier of an instance 并且反复检查没有映射没有任何问题最后发现问题竟然是主键的问题 比如我在一个合同对象中包含一个附件即1对1的关系 那么该合同的主键id假如在丢失后,进行插入不会有问题 无非是一个是JpaRepository进行保存操作一个是修改操作 区分是通过主键的id 但是如果后续附件要关联上合同的外键 那么当合同的主键丢失后 hibernat...原创 2021-10-04 23:39:01 · 2652 阅读 · 0 评论 -
spring出现java.lang.IllegalStateException异常的几种可能
Bean property 'baseDaomapper' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter? 第一种情况:可能是mapper映射文件对应的路径写错 第二种情况原创 2015-01-19 19:16:32 · 2426 阅读 · 0 评论