• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

String to Date Convertion in HQL

 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HI
I have a bean with property type java.util.Date. The corresponding
column in databse is varchar.i have written hql query like:
String hqlquery = select to_char(u.date) as date from com.User u;
My Intention is: To convert the varchar type to date type.

But it is giving exception:

Exception in thread "main" java.lang.IllegalStateException: No data type for nod
e: org.hibernate.hql.ast.tree.MethodNode
\-[METHOD_CALL] MethodNode: '('
+-[METHOD_NAME] IdentNode: 'to_date' {originalText=to_date}
\-[EXPR_LIST] SqlNode: 'exprList'

Thanks
siraj.
 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hI
Could you please store it in String, then assign to Persistent Entity

or example

String strTmp="Keep your Date String from DB";

Date dtTmp = new SimpleDateFormat("MM-dd-yyyy").parse(strTmp);

Assign this to your entity

Regards,
Sankar. S
 
reply
    Bookmark Topic Watch Topic
  • New Topic