记录bug:Unsupported property type [java.lang.Integer] for @CreationTimestamp or @UpdateTimestamp gener

博客讲述了在Spring Boot项目里,因ELadmin自动生成代码中存在@UpdateTimestamp注解,导致创建实体管理器工厂时出错。解决办法是取消该注解。同时得到启示,对代码要自行审核,遇到bug可从提示中找原因、搜索关键字。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 WARN  o.s.b.w.s.c.AnnotationConfigServletWebServerApplicationContext - 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/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Unsupported property type [java.lang.Integer] for @CreationTimestamp or @UpdateTimestamp generator annotation在这里插入图片描述

WARN o.s.b.w.s.c.AnnotationConfigServletWebServerApplicationContext - 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/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Unsupported property type [java.lang.Integer] for @CreationTimestamp or @UpdateTimestamp generator annotation

原因:ELadmin自动生成的代码,不知为啥这个注解被加上了,一直没有注意到。查了一天,猛回头才发现尽然有这个注解,@UpdateTimestamp注解的问题。取消此注解即可搞定。
启示:无论哪里来的代码,都要过自己的一关,要自己审核。遇到bug后,尽量在提示中查看原因,可以尝试搜索关键字,比如这次的**@UpdateTimestamp**,有提示,但自己没看懂没理解。网上又差不多资料。纪念一下吧。 bug就是一块砖,砖多了自然就铺成了路。

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Goldchenn

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值