@LastModifiedDate

@Convert(converter = LocalDateTime2TimestampConverter.class)

@Slf4j

public class LocalDateTime2TimestampConverter implements

AttributeConverter<LocalDateTime, Timestamp> {

@Override

public Timestamp convertToDatabaseColumn(LocalDateTime ld) {

return ld == null ? null : new Timestamp(ld.toDateTime().getMillis());

}

@Override

public LocalDateTime convertToEntityAttribute(Timestamp ts) {

if (ts != null) {

try {

return LocalDateTime.fromDateFields(ts);

} catch (IllegalArgumentException ex) {

log.warn("Can't convert {} to LocalDate", ts, ex);

}

}

return null;

}

}

customerized convert from field type to DB field's type的更多相关文章

  1. 使用elasticsearch启动项目报错failed to load elasticsearch nodes 。。。。。No type specified for field [name]

    failed to load elasticsearch nodes .....No type specified for field [name]翻译: 加载ElasticSearch节点失败... ...

  2. JAVA错误提示:The operation is not applicable to the current selection.Select a field which is not declared as type variable or a type that declares such fields.

    平时没怎么注意,今天用Eclipse自动生成Set Get方法时提示错误,错误信息如下: The operation is not applicable to the current selectio ...

  3. Failed to convert from type [java.lang.String] to type [java.util.Date] for value '2020-02-06'; nested exception is java.lang.IllegalArgumentException]解决

    今天做springbook项目前端输入日期传到数据库保存报了一下错误 Whitelabel Error Page This application has no explicit mapping fo ...

  4. JAVA反射系列之Field,java.lang.reflect.Field使用获取方法

    JAVA反射系列之Field,java.lang.reflect.Field使用获取方法.   转载https://my.oschina.net/u/1407116/blog/209383 摘要 ja ...

  5. 【spring boot】spring boot 前台GET请求,传递时间类型的字符串,后台无法解析,报错:Failed to convert from type [java.lang.String] to type [java.util.Date]

    spring boot 前台GET请求,传递时间类型的字符串,后台无法解析,报错:Failed to convert from type [java.lang.String] to type [jav ...

  6. Jpa自定义查询报错(Failed to convert from type [java.lang.Object[]] to type)

    Jpa自定义查询报错 问题背景 今天遇到一个奇怪的报错"Failed to convert from type [java.lang.Object[]] to type",这个报错 ...

  7. [Antd-vue] Warning: You cannot set a form field before rendering a field associated with the value.

    在用ant-design-vue的框架中,使用到了这种场景,就是点击编辑按钮,弹出modal模态框,渲染modal模态框中的form表单页面,并给表单赋值,但是在给表单赋值的时候,总是会报错. 错误提 ...

  8. (转)织梦dedecms模板。如何让type='image'和不带type='image'的文章同时出现在列表里。

    “节日歌圩”栏目是有内容的,但是文章没有缩略图所以没有在频道首页显示出来,我现在想要有缩略图的文章自然显示,没有缩略图的文章也能出现标题列表(依然按照一行4个标题,可以用一张“无缩略图”的图片来代替缩 ...

  9. No converter found capable of converting from type [java.lang.String] to type [java.util.Map<java.lang.String, org.springframework.boot.logging.LogLevel>]

    java.lang.IllegalStateException: Failed to load ApplicationContext at org.springframework.test.conte ...

随机推荐

  1. ESXI安装

    1.设置从USB启动 按DEL进入BIOS设置 参考http://www.upanok.com/jiaocheng/68.html 先插入USB,在选择ADVANCAED BIOS FEATURES ...

  2. elisp debug

    M-x  是运行command的意思. 若使用常规Emacs debugger(即不使用edebuger),先把要debug的函数加入到debug-on-entry:  M-x   debug-on- ...

  3. crontab 定时任务格式

    如下内容节选自<Linux Crontab 定时任务 命令详解> 用crontab -e 添加要执行的命令 添加的命令必须以如下格式: * * * * * /command path 前五 ...

  4. POJ 2031 Building a Space Station (最小生成树)

    Building a Space Station 题目链接: http://acm.hust.edu.cn/vjudge/contest/124434#problem/C Description Yo ...

  5. spring注解使用

    一.各种注解方式 1.@Autowired注解(不推荐使用,建议使用@Resource) @Autowired可以对成员变量.方法和构造函数进行标注,来完成自动装配的工作.@Autowired的标注位 ...

  6. 简单的圆形图标鼠标hover效果 | CSS3教程

    演示 本教程将和大将分享一些简单的圆形图标在鼠标hover时的动画效果.这种效果在不少时尚的酷站上都有.本教程中的例子主要是利用在a元素的伪元素上使用CSS transitions和animation ...

  7. appcompat_v7/res/values-v21/themes_base.xml No resource found that matches the given name

    今天晕死了 将工作区里的appcompat_v7删除掉了, 然后随意新建了一个工程,因为已经升级到5.0了,appcompat_v7内容有所改变, 以前的工程引用旧的appcompat_v7的某些属性 ...

  8. sgu - 274 - Spam-filter

    题意:判断一个字符串是不是有效的邮件地址. 题目链接:http://acm.sgu.ru/problem.php?contest=0&problem=274 ——>>照着题目做. ...

  9. 英特尔实感3D摄像头

    RealSense 3D(实感3D)是英特尔提供的一套感知计算解决方案,包括了手势的识别.控制,人脸的识别.认证.控制,语音识别与控制,增强现实,3D扫描和重构等许多先进的技术.包括立体眼镜(暂未公开 ...

  10. cocos2d-x 手电筒效果

    转自:http://blog.csdn.net/xujiezhige/article/details/8448524# 常见的手电筒效果,可以通过CCRenderTexture来实现.主要是通过修改渲 ...