mandar shinde
mandar shinde

Reputation: 1

Unable to query using Reference id in morphia 2.4.14 for Reference entity. use of Key<> is deprecated

I have an Entity Book. It contains Language entity. Language entity is stored as DBRef() in database. I need DBRef.

@Entity("Book")
class Book{
   @Reference(language_id)
   private Language language;
}

@Entity("Language")
class Language{
   @Id
   public String id;
   // getters and setter
}

I am trying to query Books using language Id only

query.filter(Filters.eq("language", "1232342342 ==> the ID")).disableValidation().iterator().toList();

Whenever I try to execute the query it automatically replaces the id with null (filter->value becomes null) i.e filter state becomes = > ("langauage", null) Therefore nothing is returned.

How do I query this using language ID only successfully. I do not have reference for language id.

Upvotes: 0

Views: 59

Answers (0)

Related Questions