• 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

error:literal does not match format string

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,i'm trying to insert some data of type date into database table using hibernate.i take the input date from an xhtml form as shown below

addEvent.xhtml


this is my addEvent method in EventBean.java


add method in EventDAO.java



while executing this..i get the following error: ORA-01861: literal does not match format string
could it be due to any mismatch in date format( chrome browser automatically takes date in the format mm-dd-yyyy )? if yes, how do i resolve it? (i'm using Oracle database)
 
Bartender
Posts: 3648
16
Android Mac OS X Firefox Browser Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are using JSF standard tag to generate those client, what is the type of eventBean.eventDate, string or date? I recall it needs to be string in the backing bean.

What's with the p:required and p:type? From primefaces?

I don't recall if JSF has way to format date, I used jquery's datepicker to do the formatting.

Also when inserting to Oracle database, the date field should be yyyy-mm-dd for it to work, or Oracle will complain it's not a proper date.

Given your situation, may fixing the sql to take in yyyy-mm-dd may do the trick.
 
Vav Priya
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks for that reply. i used the following command for setting the date format.



now i'm getting the following error:
ORA-01843: not a valid month

 
Saloon Keeper
Posts: 27764
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Like Tsang. I use a third-party calendar control for my date/time data. However, unless I mis-remember, you can use a java.util.Date property for an inputText control provided you use a formatDateTime converter. Which, incidentally, will help in ensuring that the month/day/year input data is at least somewhat valid.

I do NOT, however, recommend using an actionListener to handle commands in JSF. Just use the POJO "action=" method instead. There is a legitimate use for actionListener, but it's so obscure that I cannot recall ever using it in 10 years of JSF.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic