如何将Oracle Interval Day到Second数据类型映射到Java对象

时间:2019-03-12 04:34:12

标签: spring oracle hibernate spring-boot spring-data-jpa

我想将数据库中具有数据类型<img style="background:red"> <p>A function is triggered if an error occurs when loading the image. The function shows an alert box with a text. In this example we refer to an image that does not exist, therefore the onerror event occurs.</p> 的列映射到Spring Entity中的Java对象。目前,我正在为我的Java对象使用String:

Interval Day(0) to Second(2)

从我拥有的几秒中,例如:5400秒,我将其转换为天数,小时数,分钟数等,然后解析为Java对象,如下所示:

@Column
private String duration;

将要插入数据库的字符串应如下所示:

String duration = day + " " + hours + ":" + minutes + ":" + seconds + "." + miliseconds;

我想知道是否还有更好的方法?使用Java字符串映射Oracle Interval数据类型是否正确?

0 个答案:

没有答案
相关问题