I have a data model with a skeleton (metadata) and large data objects. I'd like to keep the skeleton in memory and hold weak references to the data objects. I understand how I would implement this with plain Java, how I would create a WeakHashMap and clean up etc. But I'm wondering what would be the best way to resurrect the data objects after they have been GC'd?
Should I add a technical key to my map which I assign to a field in the data object, so I can find it again? Or should I call db.ext().getId() and use this ID as the technical key? If so, how would I get these keys when loading the parent? What do you suggest?