0

I have this two tables:

@Entity()
class Cikkek {
  @Id()
  int id;
  String cikkszam = '';
  String cikknev = '';
  String gyarto = '';

  final kategoria = ToOne<Kategoriak>();
}

@Entity()
class Kategoriak {
  @Id(assignable: true)
  int azonosito = 0;
  String cikkcsoportkod = "";
  String cikkcsoportnev = "";
  int delstatus = 1;

  final Children = ToMany<Kategoriak>();
}

If i execute this query, i get all the results from the Kategoriak table, and objectbox ignores the 3 or conditions in the main table:

      list = (Store.box<Cikkek>().query(Cikkek_.cikknev.contains(search)
                .or(Cikkek_.cikkszam.startsWith(search)
                .or(Cikkek_.gyarto.contains(search)
                )),
              )
            ..link(
                Cikkek_.kategoria,
                Kategoriak_.cikkcsoportkod
                    .startsWith("A")
                    .and(Kategoriak_.delstatus.equals(1))))
          .build()
          .find();

What am i doing wrong here?

Ebadta
  • 317
  • 1
  • 3
  • 10
  • The query looks OK to me (compare with the docs on how to do link queries: https://docs.objectbox.io/queries#add-query-conditions-for-related-entities-links), so it probably is an issue with the data not being as you expect? – Uwe - ObjectBox Feb 20 '23 at 09:37

0 Answers0