Realm Result returning null
<p>The Java class RecipeDetailed   </p>

<pre><code>public class RecipeDetailed extends RealmObject {

@PrimaryKey
private int id;

private String servings;

private String title;

private String image;

private String readyInMinutes;

private boolean vegetarian;

private boolean vegan;

private boolean glutenFree;

private boolean dairyFree;

private RealmList&lt;AnalyzedInstructions&gt; analyzedInstructions;

@Ignore
private ArrayList&lt;Ingredient&gt; extendedIngredients;

public RecipeDetailed() {
}

public RecipeDetailed(int id, String servings, String title, String image, String readyInMinutes, boolean vegetarian, boolean vegan, boolean glutenFree, boolean dairyFree, RealmList&lt;AnalyzedInstructions&gt; analyzedInstructions, ArrayList&lt;Ingredient&gt; extendedIngredients) {
    this.id = id;
    this.servings = servings;
    this.title = title;
    this.image = image;
    this.readyInMinutes = readyInMinutes;
    this.vegetarian = vegetarian;
    this.vegan = vegan;
    this.glutenFree = glutenFree;
    this.dairyFree = dairyFree;
    this.analyzedInstructions = analyzedInstructions;
    this.extendedIngredients = extendedIngredients;
}

public int getId() {
    return id;
}

public String getServings() {
    return servings;
}

public String getTitle() {
    return title;
}

public String getImage() {
    return image;
}

public String getReadyInMinutes() {
    return readyInMinutes;
}

public RealmList&lt;AnalyzedInstructions&gt; getAnalyzedInstructions() {
    return analyzedInstructions;
}

public boolean isVegetarian() {
    return vegetarian;
}

public boolean isVegan() {
    return vegan;
}

public boolean isGlutenFree() {
    return glutenFree;
}

public boolean isDairyFree() {
    return dairyFree;
}

public ArrayList&lt;Ingredient&gt; getExtendedIngredients() {
    return extendedIngredients;
}}
</code></pre>

<p>The Java Class Favourites</p>

<pre><code>public class Favourites extends RealmObject {

private RecipeDetailed recipes;

@PrimaryKey
private int id;

public Favourites() {
}

public Favourites(RecipeDetailed recipes, int id) {
    this.recipes = recipes;
    this.id = id;
}

public int getId() {
    return id;
}

public void setId(int id) {
    this.id = id;
}

public RecipeDetailed getRecipes() {
    return recipes;
}

public void setRecipes(RecipeDetailed recipes) {
    this.recipes = recipes;
}}
</code></pre>

<p>The way i save the data is through this </p>

<pre><code>realm.executeTransaction(new Realm.Transaction() {
                @Override
                public void execute(Realm realm) {
                    Favourites favourites = realm.createObject(Favourites.class,recipeDetailed.getId());
                    favourites.setRecipes(recipeDetailed);
                }
            });
</code></pre>

<p>Fetching data using </p>

<pre><code>favourites = realm.where(Favourites.class).findAll();
</code></pre>

<p>Log.i("data",element.get(0).getId()+""+element.get(0).getRecipes().getTitle());</p>

<p>The problem is the first part returns the correct data ie,getid returns the correct id but getrecipes returns a null object.Any idea where i went wrong? </p>