Okay, this is what I'm getting: [DEBUG EviteApplication] I OVERRODE THIS CONVERTER: null
Strange - isn't it? The only thing I changed was to remove <Timestamp> from your IConverter definition. I'm using Wicket 1.3.4. Thoughts? Michael -----Original Message----- From: Jeremy Thomerson [mailto:[EMAIL PROTECTED] Sent: Saturday, May 31, 2008 11:18 PM To: users@wicket.apache.org Subject: Re: Timestamp -> java.util.Date convertion in Wicket Weird indeed. Do this... capture the return of your ((ConverterLocator) getConverterLocator()).set(...) call. In that method, it is returning the result of a Map.put(Timestamp.class, your-converter). Therefore, the result should be non-null, as you should be overriding the default implementation that was already put in the map. Something like: IConverter ic = ((ConverterLocator) getConverterLocator()).set(Timestamp.class, new IConverter<Timestamp>() { private static final long serialVersionUID = 1L; public Timestamp convertToObject(String value, Locale locale) { if (value == null) { return null; } if (locale == null) { locale = Locale.getDefault(); } DateFormat format = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT); try { Date date = format.parse(value); return new Timestamp(date.getTime()); } catch (ParseException e) { throw new ConversionException("Cannot parse '" + value + "' using format " + format) .setSourceValue(value).setTargetType( Timestamp.class).setConverter(this) .setLocale(locale); } } public String convertToString(final Timestamp value, Locale locale) { if (value == null) { return null; } if (locale == null) { locale = Locale.getDefault(); } DateFormat format = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT); return format.format(value); } }); System.out.println("I OVERRODE THIS CONVERTER: "+ ic); Also - what version are you running? -- Jeremy Thomerson http://www.wickettraining.com On Sun, Jun 1, 2008 at 1:05 AM, Michael Mehrle <[EMAIL PROTECTED]> wrote: > Yes, exactly the way you're doing it - didn't change anything except for > removing the generic def in the IConverter interface (not using generics > yet in my current project). > > And yes, I also set my breakpoint but it's never being called. The field > simply grabs the time value and no conversion seems to be happening. > > BTW, very elegant fix - just hope I can make this work (driving me crazy > this issue). > > Michael > > -----Original Message----- > From: Jeremy Thomerson [mailto:[EMAIL PROTECTED] > Sent: Saturday, May 31, 2008 7:14 PM > To: users@wicket.apache.org > Subject: RE: Timestamp -> java.util.Date convertion in Wicket > > Did you make sure to use the code exactly (it calls SET on the concrete > implementation rather than the standard way of just adding a converter > to the interface)? > > Which version are you using? This problem appeared in 1.3, and I have > tested my fix in all versions of of 1.3 and 1.4-m1 and m2. > > You can set a breakpoint in your implementation and in the default with > Wicket to see which is getting called. Let me know what you find. > > Jeremy Thomerson > http://www.wickettraining.com > -- sent from a wireless device > > > -----Original Message----- > From: Michael Mehrle <[EMAIL PROTECTED]> > Sent: Saturday, May 31, 2008 8:57 PM > To: users@wicket.apache.org > Subject: RE: Timestamp -> java.util.Date convertion in Wicket > > Hello Jeremy: > > I added the converter to my apps init() method per your example but the > problem persists. I keep seeing 12:00am instead of the date. Any > suggestions? > > Michael > > -----Original Message----- > From: Jeremy Thomerson [mailto:[EMAIL PROTECTED] > Sent: Friday, May 30, 2008 7:35 PM > To: users@wicket.apache.org > Subject: RE: Timestamp -> java.util.Date convertion in Wicket > > Found a link: > > http://markmail.org/message/m5cyca4vsrrvcrid > > Jeremy Thomerson > http://www.wickettraining.com > -- sent from a wireless device > > > -----Original Message----- > From: Michael Mehrle <[EMAIL PROTECTED]> > Sent: Friday, May 30, 2008 8:55 PM > To: users@wicket.apache.org > Subject: Timestamp -> java.util.Date convertion in Wicket > > I am persisting java.util.Date objects to the DB but am getting > Timestamp objects back (no surprise there since the hibernate type is > set to 'timestamp'). Wicket converts the Timestamp and populates my > field without complaining but all I'm getting is the time (12:00am - the > default start time since it wasn't set due to it originating as a Date). > Is there some sort of default converter? I assume this is a common > scenario. > > > > Thanks, > > > > Michael > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]