In a previous post, I have not been clear enough about my problem:
I have 2 class :
public class Categorie {
// Attributs
private int identifiant;
private String libelle;
...
}
public class Restaurant {
// Attributs
private int identifiant;
private String nom;
private String description;
private List<Categorie> lesCategories;
...
}
And in SQLite :
CREATE TABLE Categorie
( categorie_id INTEGER PRIMARY KEY
, libelle TEXT NOT NULL
);
CREATE TABLE Restaurant
( restaurant_id INTEGER PRIMARY KEY
, nom TEXT NOT NULL
, description TEXT
);
CREATE TABLE RestaurantCategorie
( restaurant_id INTEGER NOT NULL REFERENCES Restaurant
, categorie_id INTEGER NOT NULL REFERENCES Categorie
, PRIMARY KEY (restaurant_id, categorie_id)
);
But for create my cursor, i don't know how do it...
public Restaurant ConvertCursorToObject(Cursor c) {
Restaurant restaurant= new Restaurant (
c.getInt(EnseigneOpenHelper.NUM_RES_ID),
c.getString(EnseigneOpenHelper.NUM_RES_NOM),
c.getString(EnseigneOpenHelper.NUM_RES_DESCRIPtion),
????
);
return restaurant;
}
/** * Convert a cursor in Restaurant */
public Restaurant ConvertCursorToOneObject(Cursor c) {
c.moveToFirst();
Restaurant restaurant = ConvertCursorToObject(c);
c.close();
return restaurant ;
}
This problem it's here = "????" My constructor want an object of type List Categorie.