Comments (4)
I think you are mixing old data format with new one. Write your own serializer and handle such cases there.
from mapdb.
This got solved in the following way:
Earlier, map looked like the following:
HTreeMap map = db.hashMap("Detail")
.createOrOpen();
Fixed version:
HTreeMap<String, Detail> map = db.hashMap("Detail", Serializer.STRING, Serializer.JAVA)
.createOrOpen();
Add serialVersionUID to the class:
@Data
@NoArgsConstructor
public class Detail implements Serializable {
private static final long serialVersionUID = -4627389989283518760L;
private String source;
private String target;
}
Store some objects with string key and this class objects as values.
Now, update the class definition leaving the serialVersionUID unchanged:
@Data
@NoArgsConstructor
public class Detail implements Serializable {
private static final long serialVersionUID = -4627389989283518760L;
private String source;
private String target;
private int state; // new field
}
Persist some more objects with this class object values.
Now, you will be able to read old and new objects with this class.
Note that - in the reported scenario in my previous comment - the exception is thrown when user attempts to persist the object with new definition.
User is NOT even attempting to read the old definition objects.
Why is the exception required in this case?
from mapdb.
This looks like an issue to me. Why does mapdb need to throw an exception (about already persisted data in past) while writing new data?
from mapdb.
@jankotek ,
Could you re-open this issue?
from mapdb.
Related Issues (20)
- MapDB 3.0.10 with guava build fails HOT 3
- Question on how data is persisted HOT 1
- Does it support collections that don't fit in RAM? HOT 1
- How to debug tests from VS Code or otherwise?
- Trying to understand HTreeMap HOT 1
- Transaction Isolation HOT 1
- Using Bloom Filters to optimize overflowing HTreeMap reads
- MapDB is not reducing its size when all messages get deleted HOT 2
- Retrieving data after rollback will throw an exception
- Insertion Order Persistence HOT 1
- org.mapdb.DBException$DataCorruption: headPrev error
- compact is not working for WAL storage
- HTreeMap uses more direct memory than specified in HashMapMaker.expireStoreSize()
- Vector Collection
- When I execute db.commit() I get an alarm:Could not delete file: HOT 1
- NoClassDefFoundError regarding EnumEntries since MapDB 3.1.0 HOT 3
- IndexOutOfBoundsException on DB.commit()
- Trying to understand how it works
- API handle to get version of MapDB HOT 2
- Data corruption when using expireAfterCreate() and expireOverflow() with HashMapMaker
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mapdb.