mysql - Execute a query using Hibernate-Java -


i have query

select userid userinfo datediff(expirydate,curdate())<100; 

how can query executed using hibernate??

i have tried

list<string> usernames = (list<string>)(getsession().createquery("select userid userinfo datediff(expirydate,current_date)<100;").list());      (iterator iterator = usernames.iterator(); iterator.hasnext();){       string username= (string) iterator.next();       system.out.println(username);      } 

but does'nt return result there other way this??

if it's in native sql dialect of database, have use this:

list<string> usernames = (list<string>)(getsession().createsqlquery("yournativesqlquery").list()); 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -