Phil Whiles
unread,Dec 3, 2014, 9:40:10 AM12/3/14Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to axonfr...@googlegroups.com
I too faced this in the last few weeks, and I have a solution for you!
You will need a LocalDateConverter :
public class LocalDateConverter extends AbstractSingleValueConverter {
public boolean canConvert(Class type) {
return (type!=null) && LocalDate.class.getPackage().equals(type.getPackage());
}
public String toString (Object source) {
return source.toString();
}
public Object fromString(String str) {
try {
return LocalDate.parse(str);
} catch (Exception e) {
// deal with it
}
}
}
When you wire up the EventStore (I do it in code) :
LocalDateConverter conv = new LocalDateConverter();
Xtream xstream = new XStream();
xstream.registerConverter(conv);
XStreamSerializer xstreamSerial = new XStreamSerializer (xstream);
EventStore store = new JpaEventStore (entityManagerProvider(), xstreamSerial);
Forgive typos please - I cannot paste work code externally, so retyped above.
I use obviously use JPA - so YMMV.
HTH!
Phil