hibernated
hibernated copied to clipboard
Is it possible to execute mysql functions using hql?
i tried to execute CURRENT_DATE(), and UPPER(
"Alias name identifier expected in FROM clause near ...." "No property CURRENT_DATE found in entity ...."
here is the code i tried;
- string cmdtext = format( "FROM searchquerymodules AS sqm\r\n" ~ "JOIN sqm.searchquery AS sq\r\n" ~ "JOIN sqm._module AS m\r\n" ~ "WHERE (m.active = 1) and (m.id = %d)" ~ " and ((sq.expirydate is null) or (sq.expirydate > CURRENT_DATE()))", moduleid);
Query q = session.createQuery(cmdtext);
return q.list!searchquerymodules();
- string cmdtext = format( "FROM notifications n\r\n" ~ "JOIN n.searchquerymodule as sqm\r\n" ~ "JOIN sqm.searchquery as sq\r\n" ~ "WHERE sq.account_id = %d \r\n" ~ " and sqm.module_id = %d \r\n" ~ " and UPPER(n.url) = '%s' \r\n" ~ "", accountid, moduleid, toUpper(url));
Query q = session.createQuery(cmdtext);
return q.list!notifications();
Not supported yet. Can be implemented in future.