I am using Java 7 with hibernate 4.
Want to use the oracle Data Type Interval ( http://psoug.org/definition/INTERVAL.htm ) to represent an interval of a certain number of days.
Learning what type of Java to use to map this Oracle interval object.
I would like to use standard Java objects, not any oracle.sql objects. * as indicated in this document http://docs.oracle.com/cd/B28359_01/java.111/b31224/datacc.htm .
Here is the table I play in:
CREATE TABLE "MyTest" ( "ID" NUMBER(14,0) NOT NULL "DELIVERY_PERIOD" INTERVAL DAY (3) TO SECOND (6), CONSTRAINT "MYTEST_PK" PRIMARY KEY ("ID"));
Edit
Since then i tried with
@Temporal(TemporalType.TIME) private java.util.Date deliveryPeriod;
Getting error:
Caused by: java.sql.SQLException: Invalid column type: getTime not implemented for class oracle.jdbc.driver.T4CIntervaldsAccessor
Edit 2
http://docs.oracle.com/cd/B12037_01/java.101/b10983/datamap.htm
I know that matching it with Java String will work, but I would like it to be some kind of date object, so I don't need to parse it myself.
http://objectmix.com/jdbc-java/41781-oracle10g-oracle-sql-interval-type.html
I would also like to avoid using specific oracle data types like oracle.sql.INTERVALS
Check the SO answer :
Then your objects will just use Integer:
@TypeDef(name="interval", typeClass = Interval.class) @Type(type = "interval") private Integer interval;
Internal UserType is a Java Integer to SQL INTERVAL adapter.
If mapping to String works, you can either
to convert between String and Interval.
You can write POJO yourself for Interval or use JODA Time Duration
Duration
Source: https://habr.com/ru/post/973631/More articles:How to add space between paragraphs when using css reset? - htmlIn Scala, is it possible to make an anonymous function a default argument? - scalaPersistent instance Maybe - haskellBack to top of line in IntelliJ - intellij-ideahttps://translate.googleusercontent.com/translate_c?depth=1&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/973630/parse-not-adding-new-installs-on-ios-8-devices-to-data-browser&usg=ALkJrhhh9eOHNt0l32rWX_3Yf8O8N3AvIARotate the XAxis Label to 90 degrees - c #date_format () expects parameter 1 to be a DateTime, the string is set - date`Skip on empty` does not work in downloading a Yii2 file - yiiActually excluding files from a publication without checking - node.jsHow to find out the group and artifacts of any external cans in the maven android - android projectAll Articles