problem with lazy references

16 views
Skip to first unread message

Plamen

unread,
Feb 28, 2012, 2:53:16 PM2/28/12
to Morphia
Hi all,

I am trying to use lazy references and have the following issue that I
see was reported back in 02/19/2011
http://groups.google.com/group/morphia/browse_thread/thread/61fd1ecba9906c7/b781691b0597e726%3Fq%3D%2522Garcia%2BPalma%2522%23b781691b0597e726&ei=iGwTS6eaOpW8Qpmqic0O&sa=t&ct=res&cd=1&source=groups&usg=AFQjCNGu2yLx82Ak1nY1lZn1Q8E_UDBmLQ

I am using morphia 0.99 and mongo java driver 2.7.2.
I have two domain classes (say A and B) and corresponding DAO (say
ADao and BDao - using BasicDAO), so those two classes have their
respective collections in Mongo. Say A has parameter of type B - b
marked with @Reference(lazy=true).
Say I first create instance of type B - b1, save it using the BDao
(the id is updated accordingly).
Then I create an instance of type A - a1, set a1.b = b1 and persist it
with ADao (the id is updated accordingly and the reference object is
created as well with the correct id of b1).
Finally I look up a1 by its id thru ADao and i get the exception:
The reference({ "$ref" : "B", "$id" : "4d605eac3898991af899f899" })
could not be fetched for...

BTW, if I use the Mongo Console, I am able to find b1, by the
reference id.

Any suggestions?

Thanks
Reply all
Reply to author
Forward
0 new messages