i hope you meant tried and not chosen as in both dialect chosen at the same time ?
Code:
String hql = "select sysdate() from Category"; // "sysdate()" is correct, but "sysdate" not.
Query q = session.createQuery(hql);
List result = q.list();
Date sysdate = (Date) result.get(0);
System.out.println("sysdate = " + sysdate.toLocaleString());
[size=18]
Output: The time component of the output is always 00:00:00.
[/code]
Yes, sysdate() is a HQL function that returns a DATE not a TIMESTAMP.
Use systimestamp() ot get the wanted behavior.
Quote:
Code:
String sql = "select sysdate from dual";
SQLQuery sq = session.createSQLQuery(sql);
Object[] x = (Object[]) sq.uniqueResult();
System.out.println(x.length);
[size=18]
Output: 0.
you haven't specfied what the query returns thus hibernate just return one row with zero columns (we should maybe throw an exception here),
so to get what you want do the following:
Query sq = session.createSQLQuery(sql).addScalar("sysdate", Hibernate.TIMESTAMP);
Quote:
Please explain those output.