Reputation: 2150
I'm trying to use Morphias references. The problem is, when I specify code like this :
@Reference
public ArrayList<NotificationParticipant> users;
The code above is from Notification entity which can have infinite amount of participants, so this will result in loading all the participants. I want to specify something like this to load just some Participants (because I don't need all of them)
@Reference( order="-createdAt" limit=3 )
public ArrayList<NotificationParticipant> users;
Is there a way to do this in Morphia?
Upvotes: 0
Views: 812
Reputation: 10859
This is not available by default. You can lazily load referenced users, but that's it. You'll need to build your own implementation.
One thing to watch out for: If you only load an entity partially, what happens if you save it back to the database? Do you want to merge the old and the new data or do you only want to store the current state?
Upvotes: 0