• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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
 
Watchya got in that poodle gun? Anything for me? Or this tiny ad?
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic