{"action":"created","issue":{"url":"https://api.github.com/repos/Raizlabs/DBFlow/issues/1500","repository_url":"https://api.github.com/repos/Raizlabs/DBFlow","labels_url":"https://api.github.com/repos/Raizlabs/DBFlow/issues/1500/labels{/name}","comments_url":"https://api.github.com/repos/Raizlabs/DBFlow/issues/1500/comments","events_url":"https://api.github.com/repos/Raizlabs/DBFlow/issues/1500/events","html_url":"https://github.com/Raizlabs/DBFlow/issues/1500","id":283837290,"number":1500,"title":"UNIQUE constraint failed: While saving oneToMany relations ","user":{"login":"therajanmaurya","id":5724482,"avatar_url":"https://avatars2.githubusercontent.com/u/5724482?v=4","gravatar_id":"","url":"https://api.github.com/users/therajanmaurya","html_url":"https://github.com/therajanmaurya","followers_url":"https://api.github.com/users/therajanmaurya/followers","following_url":"https://api.github.com/users/therajanmaurya/following{/other_user}","gists_url":"https://api.github.com/users/therajanmaurya/gists{/gist_id}","starred_url":"https://api.github.com/users/therajanmaurya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/therajanmaurya/subscriptions","organizations_url":"https://api.github.com/users/therajanmaurya/orgs","repos_url":"https://api.github.com/users/therajanmaurya/repos","events_url":"https://api.github.com/users/therajanmaurya/events{/privacy}","received_events_url":"https://api.github.com/users/therajanmaurya/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-12-21T10:26:38Z","updated_at":"2018-02-16T06:07:10Z","closed_at":null,"author_association":"NONE","body":"DBFlow Version: 4.1.2\r\n\r\nBug or Feature Request: Bug\r\n\r\nDescription: I am savings oneToMany relation. \r\n\r\n```\r\n@Table(database = ExampleDatabase.class)\r\npublic class Bob extends BaseModel {\r\n\r\n    @PrimaryKey\r\n    Integer id;\r\n\r\n    @SerializedName(\"example_ids\")\r\n    List<ExampleId> exampleIds;\r\n\r\n    @OneToMany(methods = OneToMany.Method.ALL, variableName = \"exampleIds\")\r\n    public List<ExampleId> getExampleIds() {\r\n        if (exampleIds == null) {\r\n            exampleIds = SQLite.select()\r\n                    .from(ExampleId.class)\r\n                    .where(ExampleId_Table.bob_id.eq(id))\r\n                    .queryList();\r\n        }\r\n        return exampleIds;\r\n    }\r\n\r\n    public void setExampleIds(\r\n            List<ExampleyId> exampleIds) {\r\n        this.exampleIds = exampleIds;\r\n    }\r\n\r\n    @Override\r\n    public boolean save() {\r\n        boolean res = super.save();\r\n        if (exampleIds != null) {\r\n            for (ExampleId exampleId : exampleIds) {\r\n                exampleId.setBob(this);\r\n                exampleId.save();\r\n            }\r\n        }\r\n        return res;\r\n    }\r\n}\r\n```\r\n\r\n```\r\n@Table(database = ExampleDatabase.class, uniqueColumnGroups = {@UniqueGroup(groupNumber = 1, uniqueConflict = ConflictAction.FAIL)})\r\npublic class ExampleId extends BaseModel implements Parcelable {\r\n\r\n    @PrimaryKey\r\n    Integer categoryId;\r\n\r\n    @ExampleId\r\n    @Unique(unique = false, uniqueGroups = 1)\r\n    @SerializedName(\"id\")\r\n    Integer id;\r\n\r\n    @Column\r\n    @SerializedName(\"name\")\r\n    @Unique(unique = false, uniqueGroups = 1)\r\n    String name;\r\n\r\n    @ForeignKey(stubbedRelationship = true)\r\n    @Unique(unique = false, uniqueGroups = 1)\r\n    Bob bob;\r\n}\r\n```\r\n\r\nThese are my models, I am trying to do, checking `ExampleId` columns id, name, bob should be unique in a row and If unique then don't save otherwise save but It's not saving and giving me exception.\r\n\r\nandroid.database.sqlite.SQLiteConstraintException: UNIQUE constraint failed: ExampleId.id, ExampleId.name, ExampleId.bob_id (code 2067)"},"comment":{"url":"https://api.github.com/repos/Raizlabs/DBFlow/issues/comments/366152264","html_url":"https://github.com/Raizlabs/DBFlow/issues/1500#issuecomment-366152264","issue_url":"https://api.github.com/repos/Raizlabs/DBFlow/issues/1500","id":366152264,"user":{"login":"therajanmaurya","id":5724482,"avatar_url":"https://avatars2.githubusercontent.com/u/5724482?v=4","gravatar_id":"","url":"https://api.github.com/users/therajanmaurya","html_url":"https://github.com/therajanmaurya","followers_url":"https://api.github.com/users/therajanmaurya/followers","following_url":"https://api.github.com/users/therajanmaurya/following{/other_user}","gists_url":"https://api.github.com/users/therajanmaurya/gists{/gist_id}","starred_url":"https://api.github.com/users/therajanmaurya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/therajanmaurya/subscriptions","organizations_url":"https://api.github.com/users/therajanmaurya/orgs","repos_url":"https://api.github.com/users/therajanmaurya/repos","events_url":"https://api.github.com/users/therajanmaurya/events{/privacy}","received_events_url":"https://api.github.com/users/therajanmaurya/received_events","type":"User","site_admin":false},"created_at":"2018-02-16T06:07:10Z","updated_at":"2018-02-16T06:07:10Z","author_association":"NONE","body":"@agrosner any suggestion?"}}
{"actor":{"display_login":"therajanmaurya"}}