{"action":"created","issue":{"url":"https://api.github.com/repos/litesuits/android-lite-orm/issues/26","repository_url":"https://api.github.com/repos/litesuits/android-lite-orm","labels_url":"https://api.github.com/repos/litesuits/android-lite-orm/issues/26/labels{/name}","comments_url":"https://api.github.com/repos/litesuits/android-lite-orm/issues/26/comments","events_url":"https://api.github.com/repos/litesuits/android-lite-orm/issues/26/events","html_url":"https://github.com/litesuits/android-lite-orm/issues/26","id":153168916,"number":26,"title":"无法插入级联数据","user":{"login":"zhupengGitHub","id":11845222,"avatar_url":"https://avatars.githubusercontent.com/u/11845222?v=3","gravatar_id":"","url":"https://api.github.com/users/zhupengGitHub","html_url":"https://github.com/zhupengGitHub","followers_url":"https://api.github.com/users/zhupengGitHub/followers","following_url":"https://api.github.com/users/zhupengGitHub/following{/other_user}","gists_url":"https://api.github.com/users/zhupengGitHub/gists{/gist_id}","starred_url":"https://api.github.com/users/zhupengGitHub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zhupengGitHub/subscriptions","organizations_url":"https://api.github.com/users/zhupengGitHub/orgs","repos_url":"https://api.github.com/users/zhupengGitHub/repos","events_url":"https://api.github.com/users/zhupengGitHub/events{/privacy}","received_events_url":"https://api.github.com/users/zhupengGitHub/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-05-05T05:11:01Z","updated_at":"2016-05-05T06:11:28Z","closed_at":null,"body":"@Table(\"tb_user\")\r\npublic class UserModel extends BaseModel {\r\nprivate static final long serialVersionUID = 1L;\r\n\r\n    public static final String COL_MOBILE = \"mobile\";\r\n\r\n    @NotNull\r\n    @Column(COL_MOBILE)\r\n    private String mobile;\r\n\r\n   @Mapping(Relation.OneToMany)\r\n    private ArrayList<RoleModel> roles;\r\n}\r\n\r\n@Table(\"tb_role\")\r\npublic class RoleModel extends BaseModel {\r\n\r\n    @Unique\r\n    @NotNull\r\n    private int roleId;\r\n\r\n    private String role;\r\n}\r\n用\r\n public <T> void insert(T t) {\r\n        getLiteOrm().cascade().insert(t, ConflictAlgorithm.Abort);\r\n }\r\n插入数据userMode,UserModel中其他字段都可以插入，唯独roles是空\r\n"},"comment":{"url":"https://api.github.com/repos/litesuits/android-lite-orm/issues/comments/217082972","html_url":"https://github.com/litesuits/android-lite-orm/issues/26#issuecomment-217082972","issue_url":"https://api.github.com/repos/litesuits/android-lite-orm/issues/26","id":217082972,"user":{"login":"litesuits","id":3939305,"avatar_url":"https://avatars.githubusercontent.com/u/3939305?v=3","gravatar_id":"","url":"https://api.github.com/users/litesuits","html_url":"https://github.com/litesuits","followers_url":"https://api.github.com/users/litesuits/followers","following_url":"https://api.github.com/users/litesuits/following{/other_user}","gists_url":"https://api.github.com/users/litesuits/gists{/gist_id}","starred_url":"https://api.github.com/users/litesuits/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/litesuits/subscriptions","organizations_url":"https://api.github.com/users/litesuits/orgs","repos_url":"https://api.github.com/users/litesuits/repos","events_url":"https://api.github.com/users/litesuits/events{/privacy}","received_events_url":"https://api.github.com/users/litesuits/received_events","type":"User","site_admin":false},"created_at":"2016-05-05T06:11:28Z","updated_at":"2016-05-05T06:11:28Z","body":"1. 注意warnning级别的日志，会说明失败的原因。\r\n2. 注意到两者都是集成自BaseModel，注意下两者是否都有主键id字段\r\n3. roleId是Unique的，检测是否为其赋了唯一值，如果没有，那么会触发唯一性冲突，必然失败\r\n\r\n~如果解决，请关闭issue"}}