{"action":"created","issue":{"url":"https://api.github.com/repos/Raizlabs/DBFlow/issues/23","labels_url":"https://api.github.com/repos/Raizlabs/DBFlow/issues/23/labels{/name}","comments_url":"https://api.github.com/repos/Raizlabs/DBFlow/issues/23/comments","events_url":"https://api.github.com/repos/Raizlabs/DBFlow/issues/23/events","html_url":"https://github.com/Raizlabs/DBFlow/issues/23","id":53689715,"number":23,"title":"ModelView troubles","user":{"login":"wongcain","id":6285147,"avatar_url":"https://avatars.githubusercontent.com/u/6285147?v=3","gravatar_id":"","url":"https://api.github.com/users/wongcain","html_url":"https://github.com/wongcain","followers_url":"https://api.github.com/users/wongcain/followers","following_url":"https://api.github.com/users/wongcain/following{/other_user}","gists_url":"https://api.github.com/users/wongcain/gists{/gist_id}","starred_url":"https://api.github.com/users/wongcain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wongcain/subscriptions","organizations_url":"https://api.github.com/users/wongcain/orgs","repos_url":"https://api.github.com/users/wongcain/repos","events_url":"https://api.github.com/users/wongcain/events{/privacy}","received_events_url":"https://api.github.com/users/wongcain/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-01-07T22:18:36Z","updated_at":"2015-01-09T18:52:30Z","closed_at":null,"body":"I having a problem using a ModelView.  I have traced the problem to these lines in the convertToModel method in SqlUtils:\r\n\r\n```\r\n                    Class persistentClass = (Class) ((ParameterizedType) table.getGenericSuperclass()).getActualTypeArguments()[0];\r\n                    if (persistentClass.isAssignableFrom(BaseModelView.class)) {\r\n                        model = (ModelClass) FlowManager.getModelViewAdapter((Class<? extends BaseModelView<? extends Model>>) table).loadFromCursor(cursor);\r\n                    }\r\n```\r\n\r\nThe problem is that `persistentClass` gets assigned to the class of the *real* table rather than the class of the *view*, but then is checked to see if it extends BaseModelView.  As a result, `model` always returns as null. Shouldn't you instead be checking if `table` extends this class?"},"comment":{"url":"https://api.github.com/repos/Raizlabs/DBFlow/issues/comments/69380000","html_url":"https://github.com/Raizlabs/DBFlow/issues/23#issuecomment-69380000","issue_url":"https://api.github.com/repos/Raizlabs/DBFlow/issues/23","id":69380000,"user":{"login":"wongcain","id":6285147,"avatar_url":"https://avatars.githubusercontent.com/u/6285147?v=3","gravatar_id":"","url":"https://api.github.com/users/wongcain","html_url":"https://github.com/wongcain","followers_url":"https://api.github.com/users/wongcain/followers","following_url":"https://api.github.com/users/wongcain/following{/other_user}","gists_url":"https://api.github.com/users/wongcain/gists{/gist_id}","starred_url":"https://api.github.com/users/wongcain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wongcain/subscriptions","organizations_url":"https://api.github.com/users/wongcain/orgs","repos_url":"https://api.github.com/users/wongcain/repos","events_url":"https://api.github.com/users/wongcain/events{/privacy}","received_events_url":"https://api.github.com/users/wongcain/received_events","type":"User","site_admin":false},"created_at":"2015-01-09T18:52:30Z","updated_at":"2015-01-09T18:52:30Z","body":"I am trying to use the FlowCursorList with my ViewModel.   I instantiate it like this:\r\n```\r\ncursorList = new FlowCursorList<MyView>(true, MyViewModel.class);\r\n```\r\nThis creates the cursorList without error.  And doing a `cursorList.getCount()` returns the number I would expect.  The problem comes when I try `MyViewModel item = cursorList.getItem(i);`   This always returns a `null`.\r\n\r\nI stepped through the code here, and as I said, the problem seems to be in the `SqlUtils.convertToModel` method.  On line 120, the `persistentClass` always gets set as the class of the actual `Model` and not the `ModelView`, and therefore always fails the check on line 121.\r\n\r\n"}}