Migrating from Spring 2.0.3 to 3.2.2 Loaded Hibernate via the standard Spring packages via MVN.
I have looked at the Hibernate Migration guides on GitHub but did not find a note which seems to apply. A query which used to work is throwing an error now. I have not run all the queries the app does but this runs at startup so a good place to start I guess.
Here’s the HQSL:
String minuteIncrementCheckSql = "SELECT t FROM TestSuiteSchedule t "
+ "WHERE "
+ " (SYS_EXTRACT_UTC(SYSTIMESTAMP)) >= (t.startDt - (1/24/60)) and (SYS_EXTRACT_UTC(SYSTIMESTAMP)) <= t.endDt and "
+ " (CASE WHEN t.lastScheduled is null "
+ " then mod(round(((cast(SYS_EXTRACT_UTC(SYSTIMESTAMP) as date) - cast(t.startDt as date)) * 60 * 24)), t.schedule) "
+ " else mod(round((cast(SYS_EXTRACT_UTC(SYSTIMESTAMP) as date)-cast(t.lastScheduled as date))*60*24), t.schedule)END)= 0 "
+ " and t.testSuiteId in (select ts.testSuiteID from TestSuite ts where UPPER(ts.testType) in ('REGRESSION','BASIC') and UPPER(ts.executionType) in ('SCHEDULE','BOTH'))";
List<TestSuiteSchedule> list = em.createQuery(minuteIncrementCheckSql).getResultList();
when it runs I see:
org.hibernate.query.SemanticException: Operand of - is of type 'java.lang.Integer' which is not a temporal amount (it is not an instance of 'java.time.TemporalAmount')
What I have done is:
in previous version there was a dialect class:
public class OracleDialectNvarchar extends org.hibernate.dialect.Oracle12cDialect {
public OracleDialectNvarchar() {
registerHibernateType(Types.NVARCHAR, 2000, "string");
}
}
I tried putting that in but registerHibernateType seems to work a bit different.
I tried not have any dialect as this seems to be what the recommendation is.
I tried using the org.hibernate.dialect.OracleDialect which is in 6.4.1
I tried using community dialects for Oracle12
I tried using a newer JDBC driver. I have used 12.2.0.1.0 & 19.21.0.0
I guess I need a custom dialect class like what was done before but not really sure the how to on doing that.
What is it I need to do to get this to work