Currently, we serialize user's session object into database but the object changed too much lately so we decide to redesign this process. We all agree that we can't serialize the whole object and we need to save it field by field. There are 2 proposals,
- Store all fields in a map and serialize the map.
- Use
ObjectOutputStream.putFields()
.
We don't see much difference between these 2 approaches. The #1 uses familiar map interface and it's easier for everyone to use. The #2 provides the convenient methods like fields.get("confirmed", false)
etc.
We tend to go with #1. Anyone know any other benefits of #2?