[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-1573) one-to-many fails on oracle if field starts with underscore
Marco Reimann (JIRA)
noreply at atlassian.com
Mon Dec 4 12:24:04 EST 2006
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1573?page=comments#action_25551 ]
Marco Reimann commented on HHH-1573:
------------------------------------
I just noticed that the leading underscore problem was fixed under the bug id HHH-2022 in 3.2.0-cr4. I ran my testcase against the new 3.2.1-ga version and it worked out of the box. So this bug could also be considered as fixed.
> one-to-many fails on oracle if field starts with underscore
> -----------------------------------------------------------
>
> Key: HHH-1573
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1573
> Project: Hibernate3
> Type: Bug
> Components: core
> Versions: 3.1.2
> Reporter: Stephen Friedrich
> Attachments: leadingunderscore.zip, org.hibernate.util.StringHelper.patch
>
>
> Hibernate generates SQL that is invalid on Oracle, because it has fields in the select clause that start with an underscore.
> This is my field declaration:
> @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "_user")
> private Set<Permission> _permissions = new HashSet<Permission>();
> And this is the generated SQL:
> select
> _permissio0_.user_id as user4_2_,
> _permissio0_.id as id2_,
> _permissio0_.id as id40_1_,
> _permissio0_.version as version40_1_,
> _permissio0_.guid as guid40_1_,
> _permissio0_.user_id as user4_40_1_,
> _permissio0_2_.company_reference_id as company2_42_1_,
> case
> when _permissio0_1_.permission_id is not null then 1
> when _permissio0_2_.permission_id is not null then 2
> when _permissio0_.id is not null then 0
> end
> as
> clazz_1_,
> companyref1_.id as id43_0_,
> companyref1_.version as version43_0_,
> companyref1_.guid as guid43_0_,
> companyref1_.db_user_name as db4_43_0_,
> companyref1_.company_name as company5_43_0_
> from
> permissions _permissio0_
> left outer join admin_permissions _permissio0_1_ on _permissio0_.id=_permissio0_1_.permission_id
> left outer join company_permissions _permissio0_2_ on _permissio0_.id=_permissio0_2_.permission_id
> left outer join company_references companyref1_ on _permissio0_2_.company_reference_id=companyref1_.id
> where _permissio0_.user_id=?
> When executed Oracle gives this error: "ORA-00911: Ung³ltiges Zeichen" ("invalid character" in german)
> If I remove the underscore in front of every occurence of "_permissio..." then I can execute the SQL fine on the command line ("?" replaced by 1).
> This has been reported on the forum, but nobody answered. See last post in
> http://forums.hibernate.org/viewtopic.php?t=929011&highlight=ora00911&sid=c501920d028c78899884f5bfac8e827e
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list