{"id":25939555,"url":"https://github.com/kwon37xi/hibernate-customtype-same-value-binding-bug","last_synced_at":"2026-03-08T13:35:47.288Z","repository":{"id":33932042,"uuid":"37654832","full_name":"kwon37xi/hibernate-customtype-same-value-binding-bug","owner":"kwon37xi","description":"Hibernate issue https://hibernate.atlassian.net/browse/HHH-9871","archived":false,"fork":false,"pushed_at":"2015-11-14T07:35:12.000Z","size":192,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-04T04:17:53.530Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kwon37xi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-06-18T11:09:37.000Z","updated_at":"2015-06-18T14:32:26.000Z","dependencies_parsed_at":"2022-07-13T14:32:42.353Z","dependency_job_id":null,"html_url":"https://github.com/kwon37xi/hibernate-customtype-same-value-binding-bug","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kwon37xi/hibernate-customtype-same-value-binding-bug","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kwon37xi%2Fhibernate-customtype-same-value-binding-bug","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kwon37xi%2Fhibernate-customtype-same-value-binding-bug/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kwon37xi%2Fhibernate-customtype-same-value-binding-bug/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kwon37xi%2Fhibernate-customtype-same-value-binding-bug/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kwon37xi","download_url":"https://codeload.github.com/kwon37xi/hibernate-customtype-same-value-binding-bug/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kwon37xi%2Fhibernate-customtype-same-value-binding-bug/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27401153,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-11-30T02:00:05.582Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-04T04:17:57.344Z","updated_at":"2025-11-30T17:02:53.973Z","avatar_url":"https://github.com/kwon37xi.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Hibernate JPA positional parameter bug when custom type used.\n\nTeseted with hibernate 4.2.19.Final and hibernate 4.3.10.Final.\nHibernate 5 test case - https://github.com/kwon37xi/hibernate-5-hhh9871\n\nWhen there is a query that has conditions which have same Java type but custom hibernate types are different,\nand thoue types' positional parameters have same number, there is a bug.\n\n\nFor example `User` entity has three Boolean type columns but their hibernate types are different.\n\n```java\n@Type(type = \"true_false\")\n@Column(name = \"employee\", columnDefinition = \"char(1)\")\nprivate Boolean employee;\n\n@Type(type = \"yes_no\")\n@Column(name = \"male\", columnDefinition = \"char(1)\")\n\n@Column(name = \"old\")\nprivate Boolean old;\n```\n\nIn this situation, if you make a query like the following(Run kr.pe.kwonnam.hibernatesutomtime.HibernateBugReproduce class),\n\n```java\nfinal Query query = session.createQuery(\n    \"from User user where  employee = ?1 and  male = ?1 and  old = ?2\");\nquery.setParameter(\"1\", Boolean.TRUE);\nquery.setParameter(\"2\", Boolean.FALSE);\n```\nThere are three parameters, but first two have the same java type and value, so positional parameter is required only `?1`.\nQueryDSL works like this.\n\nReal generated sql and parameters are like the following,\n```\nselect user0_.id as id1_0_, user0_.employee as employee2_0_, user0_.male as male3_0_,\nuser0_.name as name4_0_, user0_.old as old5_0_ from User user0_ \nwhere user0_.employee=? and user0_.male=? and user0_.old=?\n```\n```\n{1: 'T', 2: 'T', 3: FALSE};\n```\n\nBut male column's type is 'yes_no', so the second parameter must be 'Y', we expected that the parameters are like the following,\n```\n{1: 'T', 2: 'Y', 3: FALSE};\n```\n\nIf employee and male conditions are exchanged, like the following,\n```\nfinal Query query = session.createQuery(\n    \"from User user where  male = ?1 and employee = ?1 and old = ?2\");\nquery.setParameter(\"1\", Boolean.TRUE);\nquery.setParameter(\"2\", Boolean.FALSE);\n```\nReal mapped parameters are like the following,\n```\n{1: 'Y', 2: 'Y', 3: FALSE};\n```\nBut we expected that the parameters are like the following, \n```\n{1: 'Y', 2: 'T', 3: FALSE};\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkwon37xi%2Fhibernate-customtype-same-value-binding-bug","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkwon37xi%2Fhibernate-customtype-same-value-binding-bug","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkwon37xi%2Fhibernate-customtype-same-value-binding-bug/lists"}