MongoDbConnection
如果我包含String q = "select id from Calendar c " +
"where c.isActive = 1 and " +
"date_part('dow', '2017-09-19 13:23:23'::date) = c.frequencyValue)";
Query query = em.createQuery(q);
List results = query.getResultList();
,hibernate会因为::date
与参数冲突而抱怨,但如果我不这样做,postgres会抱怨。 :
我该怎么办?
答案 0 :(得分:1)
https://docs.jboss.org/hibernate/orm/3.3/reference/en/html/queryhql.html#queryhql-expressions
如果基础数据库支持它们,指定的提取函数应该有效:
extract(dow from date '2017-09-19 13:23:23');
应该有效