I have a problem with resultsets where some columns are null in the database.
For example I use the following Hibernate query:
Code:
Select c.conId, c.gId.gender, c.name, c.phoneId.prefix, c.phone, c.faxId.prefix, c.fax, c.email from EtContacts c where lower(c.etContactTypeMany.conTypeId) =:ConTypeId and lower(c.etEdiPartnerMany.paId) =:paId order by c.primary asc
This is the SQL, that is made by Hibernate
Code:
*/ select etcontacts0_.CON_ID as col_0_0_, etgenderty1_.GENDER as col_1_0_, etcontacts0_.NAME as col_2_0_, etphonepre2_.PREFIX as col_3_0_, etcontacts0_.PHONE as col_4_0_, etfaxprefi3_.PREFIX as col_5_0_, etcontacts0_.FAX as col_6_0_, etcontacts0_.EMAIL as col_7_0_ from EDITOOLS.ET_CONTACTS etcontacts0_, EDITOOLS.ET_GENDERTYPE etgenderty1_, EDITOOLS.ET_PHONE_PREFIX etphonepre2_, EDITOOLS.ET_FAX_PREFIX etfaxprefi3_, EDITOOLS.ET_CON2CONTYPE etcontactt4_, EDITOOLS.ET_CONTACT_TYPE etcontactt5_, EDITOOLS.ET_PA2CON etedipartn6_, EDITOOLS.ET_EDI_PARTNER etedipartn7_ where etcontacts0_.CON_ID=etedipartn6_.CON_ID and etedipartn6_.PA_ID=etedipartn7_.PA_ID and etcontacts0_.CON_ID=etcontactt4_.CON_ID and etcontactt4_.CON_TYPE_ID=etcontactt5_.CON_TYPE_ID and etcontacts0_.FAX_ID=etfaxprefi3_.FAX_ID and etcontacts0_.PHONE_ID=etphonepre2_.PHONE_ID and etcontacts0_.G_ID=etgenderty1_.G_ID and lower(etcontactt5_.CON_TYPE_ID)=? and lower(etedipartn7_.PA_ID)=? order by etcontacts0_.PRIMARY asc
The query shows some data, as long as all columns have data, but when for example the c.faxId.prefix is null in the Database, no data is shown. It seems to me, that there is a problem with the Joins Hibernate makes.
How can I change my Hibernate Query to work even if some columns are null?
thx
Regards
Hibernate version:
3.0.5