Okay, following up to my own post:
Well, I was able to get it to work, but it raises an interesting issue. I ended up modifying my entity to have a different id, such that my collection of primitives was joined to my entity through that key. This is a bit of an inconvenience, since the id column isn't really the PK for the table, but it is the key through which my primitive array is joined.
Once I did that, I was able to get Hibernate to generate the SQL I wanted by using the {pack.*} notation in my select statement. I wish I knew what columns {pack.*} is comprised of for a collection of elements ({pack.key} and {pack.value}, perhaps?), since I'd like to add only the one column to my resultset, but whatever.
In any case, my sql-query ended up looking like this:
Code:
<sql-query name="getPromotionItemDetails">
<return alias="details" class="com.foo.entity.PromotionItemDetails"/>
<return-join alias="pack" property="details.packs"/>
select bp.BITM_NUMB as {details.bitmNumb},
bp.PSPR_CODE as {details.upc},
bp.PSPR_CODE_TYPE as {details.upcType},
v.DIST_DESC as {details.description},
SZE.SIZE_DESC as {details.unit},
{pack.*}
from BITM_PSPR bp,
DPAC_CONT pack,
VRNT v,
SZE,
STIT
where bp.BITM_NUMB = v.BITM_NUMB
and v.BITM_NUMB = stit.BITM_NUMB
and stit.SIZE_NUMB = SZE.SIZE_NUMB
and bp.PSPR_CODE = :id
and pack.BITM_NUMB_VRNT = bp.BITM_NUMB
order by pack.VRNT_QUAN_DPAC asc
</sql-query>
I wish I could put the correct alias in the order by clause as well (again, would that be {pack.value}?), but again, it's no big deal.
So through all this I learned:
* You can have native sql queries that join to primitive collections
* You need to specify the primitive in the query as {primitive.*}, which will add
two columns to your output
* Joining is pretty easy using <return-join>, you just specify the collection you're joining to through the alias of the entity you're joining from