Do you have a stack-trace? What version were you upgrading from?
> In the end I found the root cause is in the resolveObject method of
> ReferenceMapper class:
> Object resolveObject(final DBRef dbRef, final MappedField mf, EntityCache
> cache, Mapper mapr) {
> Key key = new Key(mf.getSubClass(), dbRef.getId());
> // key.updateKind(mapper);
> Object cached = cache.getEntity(key);
> if (cached != null)
> return cached;
> The assumption of the above logic is each object in mongodb should have a
> unique ID. If the ID type is ObjectID, that's no problem. However, in my
A Key<T> is a collectionName(Class) + @Id field value (_id), and has
nothing to do with an ObjectId. Now that I think about it, there is a
problem with this *if*, and only if, you are using capped collections
and repeat _id values. I'll add an issue to address that.
> case, the ID type is Long, and the ID is generated as per collection name.
> Thus, when I expect class A object with ID = 1, the code return a class B
> object with ID = 1.
> I am not sure this should be attributed to a bug or a new feature that will
> break functionality of existing application. Please advise.
If you have a test for what is going wrong please file an issue and I
can take a look at exactly what is happening.
> Regards,
> Green
The subType/Class is only used when it is mapping a
Array/Collection/List/Map. I would assume the author of a post is not
a list, but single item, correct?
> "key". Meaning the cache is using only _id instead of collectionName + _id
The cache is a Map<Key<T>, Object>, and the Key<T> always contains
both the collection and _id value, so that a single entity can be
identified.
> to index the cached object. However the realType point to the correct type
> information of this field.
Can you provide the class def for "models.Post"? Also, can you post
the data stored in mongodb for the post that is causing the problem?
On Sat, Dec 4, 2010 at 11:18 PM, Scott Hernandez
I'm sorry for the bug; that was dumb.