[hibernate-issues] [Hibernate-JIRA] Created: (ANN-662) composite id not delimited properly in the projection of a subquery

Nick Padgett (JIRA) noreply at atlassian.com
Wed Sep 26 16:13:57 EDT 2007


composite id not delimited properly in the projection of a subquery
-------------------------------------------------------------------

                 Key: ANN-662
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-662
             Project: Hibernate Annotations
          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