2017-04-12 1 views
0

Ich habe 2 Modelle wie folgt aus:Mehrere Tomany für 1 Tisch greenDAO

@Entity 
public class Book { 

    @Id 
    Long _id; 

    String name; 

    @ToMany(referencedJoinProperty = "bookId") 
    List<Chapter> chapters1; 

    @ToMany(referencedJoinProperty = "bookId") 
    List<Chapter> chapters2; 
} 


@Entity 
public class Chapter { 

    @Id 
    Long _id; 

    String name; 
    int type; 
    long bookId; 
    @ToOne(joinProperty = "bookId") 
    Book book; 
} 

Es gibt 2 Arten von Kapitel Typ1 und 2, zur Zeit, als ich den Kapiteln 1 erhalten, greenDAO Rückkehr alle Typ1 und 2, wie kann ich Erhalten Sie nur Typ 1 oder 2 in der Klasse Buch?

Antwort

0

Diese Abfrage

Select from Chapter where type = [1 or 2] 
+0

Ich weiß, auszuführen, dass ich eine Abfrage wie das schreiben kann, aber ich will erwartetes Ergebnis zum Abrufen von greenDAO Code generiert. Gibt es eine Möglichkeit, dies zu tun? – maphongba008

Verwandte Themen