{"action":"created","issue":{"url":"https://api.github.com/repos/requery/requery/issues/313","repository_url":"https://api.github.com/repos/requery/requery","labels_url":"https://api.github.com/repos/requery/requery/issues/313/labels{/name}","comments_url":"https://api.github.com/repos/requery/requery/issues/313/comments","events_url":"https://api.github.com/repos/requery/requery/issues/313/events","html_url":"https://github.com/requery/requery/issues/313","id":184621013,"number":313,"title":"fail to insert under relationship @ManyToOne ","user":{"login":"s1155030742","id":10613896,"avatar_url":"https://avatars.githubusercontent.com/u/10613896?v=3","gravatar_id":"","url":"https://api.github.com/users/s1155030742","html_url":"https://github.com/s1155030742","followers_url":"https://api.github.com/users/s1155030742/followers","following_url":"https://api.github.com/users/s1155030742/following{/other_user}","gists_url":"https://api.github.com/users/s1155030742/gists{/gist_id}","starred_url":"https://api.github.com/users/s1155030742/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/s1155030742/subscriptions","organizations_url":"https://api.github.com/users/s1155030742/orgs","repos_url":"https://api.github.com/users/s1155030742/repos","events_url":"https://api.github.com/users/s1155030742/events{/privacy}","received_events_url":"https://api.github.com/users/s1155030742/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-10-22T09:47:56Z","updated_at":"2016-11-02T05:13:11Z","closed_at":null,"body":"I have 2 table DeviceLostRecord and Device which is in @ManyToOne relationship:\n\n`\n@Entity\npublic interface Device extends Observable, Parcelable, Persistable {\n\n```\n@Key\n@Generated\nint getId();\n\n@Bindable\nString getName();\n```\n\n}\n\n@Entity\npublic interface DeviceLostRecord  extends Observable, Parcelable, Persistable {\n\n```\n@Key\n@Generated\nint getId();\n\n@Column(value = \"CURRENT_TIMESTAMP\")\nDate getCreateTime();\n\n@Bindable\nLocation getLocation();\n\n@ManyToOne(cascade = {CascadeAction.NONE})\nDevice getDevice();\n```\n\n}\n`\n\nwhen I attempt to insert a new record of DeviceLostRecord by:\n`\n    public Observable<DeviceLostRecordEntity> addDeviceLostRecord(final Device device,final Location location) {\n\n```\n    DeviceLostRecordEntity newLost = new DeviceLostRecordEntity();\n\n    newLost.getDevice().add(device);\n    newLost.setLocation(location);\n    return dataStore.insert(newLost).toObservable();\n}\n```\n\n`\n\nIt throws exception like this:\n\n> java.lang.IllegalStateException: Exception thrown on Scheduler.Worker thread. Add `onError` handling.\n> \n> Caused by: rx.exceptions.OnErrorNotImplementedException: table DeviceLostRecord has no column named device (code 1): , while compiling: insert into DeviceLostRecord (createTime, device, location) values (?, ?, ?)\n\nI have no idea about the solution after googled for one and half day...\n"},"comment":{"url":"https://api.github.com/repos/requery/requery/issues/comments/257774364","html_url":"https://github.com/requery/requery/issues/313#issuecomment-257774364","issue_url":"https://api.github.com/repos/requery/requery/issues/313","id":257774364,"user":{"login":"s1155030742","id":10613896,"avatar_url":"https://avatars.githubusercontent.com/u/10613896?v=3","gravatar_id":"","url":"https://api.github.com/users/s1155030742","html_url":"https://github.com/s1155030742","followers_url":"https://api.github.com/users/s1155030742/followers","following_url":"https://api.github.com/users/s1155030742/following{/other_user}","gists_url":"https://api.github.com/users/s1155030742/gists{/gist_id}","starred_url":"https://api.github.com/users/s1155030742/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/s1155030742/subscriptions","organizations_url":"https://api.github.com/users/s1155030742/orgs","repos_url":"https://api.github.com/users/s1155030742/repos","events_url":"https://api.github.com/users/s1155030742/events{/privacy}","received_events_url":"https://api.github.com/users/s1155030742/received_events","type":"User","site_admin":false},"created_at":"2016-11-02T05:13:11Z","updated_at":"2016-11-02T05:13:11Z","body":"Yes it inserted the newLost object. Also, it did an insert to the device table.... , which is unwanted.\r\n\r\nFor instance, initial I have \r\n\r\nDevice table :\r\n- device 1\r\n\r\nNewLost table :\r\n\r\nafter doing  `dataStore.insert(newLost).toObservable();` :\r\n\r\nDevice table :\r\n- device 1\r\n- device 1\r\n\r\nNewLost table :\r\n- NewLost"}}
{"actor":{"display_login":"s1155030742"}}