[hibernate-dev] force outer-join with map collection index in where clause
Anthony Fryer
apfryer at hotmail.com
Wed Oct 1 19:01:47 EDT 2008
I have a class mapped as follows... <class name="equipment" table="MSF600"> <id name="equipNo" column="EQUIP_NO"/> <map name="nameplate" table="MSF6A4" outer-join="true" fetch="join"> <key column="EQUIP_NO"/> <map-key column="ATTRIB_NAME" type="string"/> <element column="ATTRIB_VALUE" type="string"/> </map> </class> The map collection allows me to perform queries on the equipment as follows... from equipment where nameplate["TARIFF"] not in ('RU', 'BG') This works fine up until I want to do a query like this... from equipment where nameplate["TARIFF"] is null or nameplate["TARIFF"] not in ('RU', 'BG') The problem happens because hibernate performs an implicit inner join with the MSF6A4 table when it detects a nameplate[""] in the where clause. If the "TARIFF" nameplate doesn't exist, the join will not match and so no results will be returned. I know I can use... from equipment where "TARIFF" not in indices(nameplate) but still doesn't work in a combined where clause like this.. from equipment where "TARIFF" not in indices(nameplate) or nameplate["TARIFF"] not in ('RU', 'BG') because as soon as the nameplate["TARIFF"] appears, hibernate does the implicit inner join to MSF6A4 again and finds no results. I think my problem would be solved if I could force hibernate to perform an outer-join on the MSF6AF table. Is this possible? Is there some other way to get this to work?
_________________________________________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/hibernate-dev/attachments/20081001/aeb089fe/attachment.html
More information about the hibernate-dev
mailing list