[hibernate-issues] [Hibernate-JIRA] Closed: (HHH-5140) quoted column doesn't be quoted in sub-query
Strong Liu (JIRA)
noreply at atlassian.com
Wed Apr 21 01:18:33 EDT 2010
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-5140?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Strong Liu closed HHH-5140.
---------------------------
> quoted column doesn't be quoted in sub-query
> --------------------------------------------
>
> Key: HHH-5140
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5140
> Project: Hibernate Core
> Issue Type: Bug
> Components: core
> Affects Versions: 3.5.1
> Reporter: Strong Liu
> Assignee: Strong Liu
> Fix For: 3.5.x
>
>
> for example:
> {quote}
> <union-subclass name="Employee" table="UEmployee">
> <property name="title" column="`unique`"/>
> <property name="department" column="dept"/>
> <many-to-one name="manager" column="mgr_id" class="Employee" cascade="none"/>
> <set name="minions" inverse="true" lazy="true" cascade="all">
> <key column="mgr_id"/>
> <one-to-many class="Employee"/>
> <filter name="region" condition="region = :userRegion"/>
> </set>
> </union-subclass>
> {quote}
> note, that "title" property's column name is unique, and "unique" is a keyword in all DBs,
> hibernate generates the column quoted, like this:
> {quote}
> create table UEmployee (
> person_id bigint not null,
> name varchar(255),
> company varchar(255),
> region varchar(255),
> "unique" varchar(255),
> dept varchar(255),
> mgr_id bigint,
> primary key (person_id),
> unique (name)
> )
> {quote}
> but with a simple hql query "from Person", which "Person" is the parent class of Employee, it will issue the following sql query:
> {quote}
> select
> person0_.person_id as person1_0_,
> person0_.name as name0_,
> person0_.company as company0_,
> person0_.region as region0_,
> person0_."unique" as unique1_1_,
> person0_.dept as dept1_,
> person0_.mgr_id as mgr3_1_,
> person0_.contactOwner as contactO1_2_,
> person0_.clazz_ as clazz_
> from
> ( select
> person_id,
> name,
> company,
> region,
> null as unique,
> null as dept,
> null as mgr_id,
> null as contactOwner,
> 0 as clazz_
> from
> UPerson
> union
> select
> person_id,
> name,
> company,
> region,
> unique,
> dept,
> mgr_id,
> null as contactOwner,
> 1 as clazz_
> from
> UEmployee
> union
> select
> person_id,
> name,
> company,
> region,
> null as unique,
> null as dept,
> null as mgr_id,
> contactOwner,
> 2 as clazz_
> from
> UCustomer
> ) person0_
> where
> person0_.region = ?
> {quote}
> see this "null as unique"?
> this can be reproduced by org.hibernate.test.subclassfilter.UnionSubclassFilterTest
--
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