0

I have a model that has a one-to-many relationship of itself. Every time I run my android application, I keep getting an SQLException that states that my Foreign Collection class Route for my field childRoutes column-name does not contain a foreign field of class Route. I feel like I specified this already in my Model but I may be missing something?

Here is my model excluding the getters/setters:

public class Route implements Serializable{

@DatabaseField(id = true, canBeNull = false, columnName = "id")
private long id;

@DatabaseField(columnName = "parent", foreign = true)
private Route parent;

@ForeignCollectionField
private ForeignCollection<Route> childRoutes;

}

I followed this question here but I still can't seem to be getting it right. ORMLITE one-to-many recursive relationship

Community
  • 1
  • 1
remedy.
  • 2,032
  • 3
  • 25
  • 48

1 Answers1

0

I seemed to have solved the issue by replacing private ForeignCollection<Route> to just Collection<Route>. I'm not quite sure why it's not working if I use ForeignCollection as the type, but it seems to fix all my issues.

remedy.
  • 2,032
  • 3
  • 25
  • 48