[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-2873) composite id not delimited properly in the projection of a subquery

Alex Goncharuk (JIRA) noreply at atlassian.com
Thu Oct 18 09:53:39 EDT 2007


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2873?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_28464 ] 

Alex Goncharuk commented on HHH-2873:
-------------------------------------

+1. 
I  had to convert all composite id to the list of the fields instead of using projections.id


> composite id not delimited properly in the projection of a subquery
> -------------------------------------------------------------------
>
>                 Key: HHH-2873
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2873
>             Project: Hibernate3
>          Issue Type: Bug
>            Reporter: Nick Padgett
>
> composite id not delimited properly in the projection of a subquery.  This is an issue in hibernate-3.2.5.ga.
> Here is my hibernate mapping file:
> <?xml version="1.0"?>
> <!DOCTYPE hibernate-mapping PUBLIC
> 	"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
> 	"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
> <hibernate-mapping package="localhost.entity.impl">
> 	<class name="ParticipantImpl" table="EVENT_PARTICIPANT"
> 		mutable="false">
> 		<composite-id name="id" class="ParticipantId">
> 			<key-property name="eventId" type="long" column="EVENT_ID" />
> 			<key-property name="teamId" type="long" column="TEAM_ID" />
> 			<key-property name="participantId" type="long"
> 				column="PARTICIPANT_ID" />
> 		</composite-id>
> 		<property name="homeAway" type="string" column="HOME_VSTR_IND"
> 			length="5" />
> 	</class>
> </hibernate-mapping>
> Here is my query:
>         DetachedCriteria detachedCriteria;
>         Organization organization;
>         DetachedCriteria orgDetachedCriteria;
>         detachedCriteria = DetachedCriteria.forClass(EventImpl.class, "e");
>         organization = eventCriteria.getOrganization();
>         if (null != organization) {
>             orgDetachedCriteria = DetachedCriteria.forClass(
>                     ParticipantImpl.class, "p");
>             orgDetachedCriteria.setProjection(Projections.id());
>             orgDetachedCriteria.add(Restrictions
>                     .eqProperty("e.id", "p.eventId"));
>             detachedCriteria.add(Subqueries.exists(orgDetachedCriteria));
>         }
> The subquery ends up looking like:
> select this0__.EVENT_ID as y0_this0__.TEAM_ID as y1_this0__.PARTICIPANT_ID as y2_ from PUBLIC.EVENT_PARTICIPANT this0__ where this_.EVENT_ID=this0__.EVENT_ID
> Notice that there are commas missing after "y0_", "y1_", and "y2_".

-- 
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