用hql语句怎么得到数据库时间(数据库不在本地)

解决方案 »

  1.   

    数据库有自带的Date函数,可以用Date来获取时间
      

  2.   

    mysql: select now()
    oracle: select systimestamp from dual
    纯hql不要select?不知道对象怎么映射到表
      

  3.   

    mysql: select now()
    oracle: select systimestamp from dual
    hibernate有个createQuery方法,你可以写原生的sql
      

  4.   

    db2: select current date
      

  5.   

    写sql语句 用hibernate自带的createQuery() 希望对楼主有帮助