Expert |
|
Joined: Mon Jan 09, 2006 5:01 pm Posts: 311 Location: Sacramento, CA
|
try:
<sql-query name="getTS">
<return-scalar column="DT" type="java.sql.Timestamp"/>
select now() as dt
</sql-query>
Then in your java code call w/ something like:
Query q = sess.getNamedQuery("getTS");
Object obj=q.uniqueResult();
if(obj instanceof Long)
{
System.out.println("answer:" + ((java.sql.Timestamp)obj).toString());
}
//or you can loop through the results with:
Iterator itr=q.list().iterator();
while(itr!=null&&itr.hasNext())
{
obj=itr.next();
System.out.println("answer:" + ((java.sql.Timestamp)obj).toString());
}
_________________ -JT
If you find my replies helpful, please rate by clicking 'Y' on them. I appreciate it.
|
|