{"action":"created","issue":{"url":"https://api.github.com/repos/querydsl/querydsl/issues/1968","repository_url":"https://api.github.com/repos/querydsl/querydsl","labels_url":"https://api.github.com/repos/querydsl/querydsl/issues/1968/labels{/name}","comments_url":"https://api.github.com/repos/querydsl/querydsl/issues/1968/comments","events_url":"https://api.github.com/repos/querydsl/querydsl/issues/1968/events","html_url":"https://github.com/querydsl/querydsl/issues/1968","id":165392076,"number":1968,"title":"Casebuilder could not determine data type for searched case statement","user":{"login":"michaelhum","id":6801291,"avatar_url":"https://avatars.githubusercontent.com/u/6801291?v=3","gravatar_id":"","url":"https://api.github.com/users/michaelhum","html_url":"https://github.com/michaelhum","followers_url":"https://api.github.com/users/michaelhum/followers","following_url":"https://api.github.com/users/michaelhum/following{/other_user}","gists_url":"https://api.github.com/users/michaelhum/gists{/gist_id}","starred_url":"https://api.github.com/users/michaelhum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michaelhum/subscriptions","organizations_url":"https://api.github.com/users/michaelhum/orgs","repos_url":"https://api.github.com/users/michaelhum/repos","events_url":"https://api.github.com/users/michaelhum/events{/privacy}","received_events_url":"https://api.github.com/users/michaelhum/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-07-13T18:40:22Z","updated_at":"2016-07-15T05:32:32Z","closed_at":null,"body":"The old code:\r\n\r\n`new CaseBuilder()\r\n.when(foo.id.eq(NumberTemplate.create(Integer.class, \"1\").then(BooleanTemplate.FALSE)\r\n.when(foo.id.eq(NumberTemplate.create(Integer.class, \"2\").then(BooleanTemplate.TRUE)\r\n.otherwise(new NullExpression<>(Boolean.class)\r\n`\r\n\r\nI've tried replacing it with\r\n\r\n`new CaseBuilder()\r\n.when(foo.id.eq(Expressions.asNumber(1).then(false)\r\n.when(foo.id.eq(Expressions.asNumber(2)).then(true)\r\n.otherwise(Expressions.nullExpression(Boolean.class))\r\n`\r\n\r\nwhich didn't work. I get the error\r\n\r\norg.hibernate.QueryException: Could not determine data type for searched case statement\r\n\r\n\r\n I then tried using Expressions.constant(), which also didn't work. Finally, I tried Expressions.asBoolean() and Expressions.FALSE, which doesn't compile due to ambiguous method call: valid in Predicate and ComparableExpression.\r\n\r\nI should note that explicitly casting Expressions.FALSE to Expression does allow the code to compile (and generate valid SQL), although now there are unchecked warnings. \r\n"},"comment":{"url":"https://api.github.com/repos/querydsl/querydsl/issues/comments/232863511","html_url":"https://github.com/querydsl/querydsl/issues/1968#issuecomment-232863511","issue_url":"https://api.github.com/repos/querydsl/querydsl/issues/1968","id":232863511,"user":{"login":"tan31989","id":3784194,"avatar_url":"https://avatars.githubusercontent.com/u/3784194?v=3","gravatar_id":"","url":"https://api.github.com/users/tan31989","html_url":"https://github.com/tan31989","followers_url":"https://api.github.com/users/tan31989/followers","following_url":"https://api.github.com/users/tan31989/following{/other_user}","gists_url":"https://api.github.com/users/tan31989/gists{/gist_id}","starred_url":"https://api.github.com/users/tan31989/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tan31989/subscriptions","organizations_url":"https://api.github.com/users/tan31989/orgs","repos_url":"https://api.github.com/users/tan31989/repos","events_url":"https://api.github.com/users/tan31989/events{/privacy}","received_events_url":"https://api.github.com/users/tan31989/received_events","type":"User","site_admin":false},"created_at":"2016-07-15T05:32:32Z","updated_at":"2016-07-15T05:32:32Z","body":"I guess you can give a try for this solution that was related to Hibernate doing something with lietrals: http://stackoverflow.com/questions/26648491/querydsl-could-not-determine-data-type-for-searched-case-statement#answer-27190771"}}
{"actor":{"display_login":"tan31989"}}