JDBM3
JDBM3 copied to clipboard
Does not work with JodaTime
Consider the unit test below. The test fails with NotSerializableException. However if i switch to java serialiazation mechanism everything works as expected.
import java.util.List;
import org.apache.jdbm.DB; import org.apache.jdbm.DBMaker; import org.joda.time.DateTime; import org.junit.Test;
public class JDBMTester {
@Test
public void testJodaTime() {
DB db = DBMaker.openFile("tmp1").make();
List<DateTime> list = getList(db, "list1");
list.add(new DateTime());
db.commit();
db.close();
}
private <K> List<K> getList(DB db, String name) {
List<K> result = db.getLinkedList(name);
if (result == null) {
result = db.createLinkedList(name);
}
return result;
}
}