google-code-export / morphia

Automatically exported from code.google.com/p/morphia
1 stars 0 forks source link

Missing reference when update DataModel #267

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What version are you using? (Morphia/Driver:0.99/MongoDB:1.6.5)

Please include a stack trace below:

Hi, I have an issue with Mongo documents ID. I have an unique BSON id who is 
included in my DAO objects. When i update the source code and perform actions 
on mongo documents the BSON id sometimes is updated and referenced documents 
lost it causing a DBRef exception:

Caused by: java.lang.RuntimeException: 
com.google.code.morphia.mapping.MappingException: The reference({ "$ref" : 
"Metric", "$id" : "4d920345cac2501c83347ebf" }) could not be fetched for 
MetricExecution.metric

I recently change the annotation to avoid this exception but i'm still having 
the lost reference issue. I will try to get a more concrete issue

Morphia updates the BSON id in any case?

Thanks in advance, Javier

PD: Sorry for my poor english, too ;-)

Original issue reported on code.google.com by milinkop...@gmail.com on 11 Apr 2011 at 10:47

GoogleCodeExporter commented 9 years ago
Please provide an example/test-case. 

Your description does not provide enough information to diagnose this problem.

This simply sounds like you are not saving your entity that you are 
referencing; if not, there is nothing we can do in code to help you.

Original comment by scotthernandez on 13 Apr 2011 at 2:19