Ich führe folgende Query aus (HQL):
Code:
select proc.transportDevice, proc.driver, proc.coDriver from TransportProcess as proc
ich erwarte etwas zu erhalten wie:
Code:
device1, driver1, codriver1
device2, driver2, null
device3, driver3, codriver3
ich erhalte aber:
Code:
device1, driver1, codriver1
device3, driver3, codriver3
Die 2. Reihe wo proc.coDriver null ist wird komplett weg gelassen! Ist das korrekt?
Hibernate version: Hibernate 2.1.8
Mapping documents:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping
>
<class
name="com.optitrans.ejb.model.TransportProcess"
table="OT_Transportvorgang"
dynamic-update="false"
dynamic-insert="false"
select-before-update="false"
optimistic-lock="version"
>
<id
name="id"
column="ID"
type="java.lang.Long"
unsaved-value="null"
>
<generator class="seqhilo">
<!--
To add non XDoclet generator parameters, create a file named
hibernate-generator-params-TransportProcess.xml
containing the additional parameters and place it in your merge dir.
-->
</generator>
</id>
<version
name="version"
type="java.util.Date"
column="Version"
access="property"
unsaved-value="undefined"
/>
<many-to-one
name="coDriver"
class="com.optitrans.ejb.model.Employee"
cascade="none"
outer-join="auto"
update="true"
insert="true"
access="property"
column="ID_Mitarbeiter_Beifahrer"
not-null="false"
/>
<many-to-one
name="driver"
class="com.optitrans.ejb.model.Employee"
cascade="none"
outer-join="auto"
update="true"
insert="true"
access="property"
column="ID_Mitarbeiter_Fahrer"
not-null="true"
/>
<property
name="endLastTransport"
type="java.util.Date"
update="true"
insert="true"
access="property"
column="EndeLetzterTransport"
/>
<property
name="startFirstTransport"
type="java.util.Date"
update="true"
insert="true"
access="property"
column="BeginnErsterTransport"
/>
<set
name="transportTasks"
lazy="true"
inverse="false"
cascade="none"
sort="unsorted"
>
<key
column="ID_Transportvorgang"
>
</key>
<one-to-many
class="com.optitrans.ejb.model.TransportTask"
/>
</set>
<many-to-one
name="transportDevice"
class="com.optitrans.ejb.model.TransportDevice"
cascade="none"
outer-join="auto"
update="true"
insert="true"
access="property"
column="ID_Transportmittel"
not-null="false"
/>
<!--
To add non XDoclet property mappings, create a file named
hibernate-properties-TransportProcess.xml
containing the additional properties and place it in your merge dir.
-->
</class>
</hibernate-mapping>
Database: Firebird 1.5.2.4731
The generated SQL (show_sql=true):
maybe not so interesting...
Code:
**************************************
select transportd1_.ID as ID0_, employee2_.ID as ID1_, employee3_.ID as ID2_, transportd1_.Version as Version0_, transportd1_.Beschreibung as Beschrei3_0_, transportd1_.IstBenutzerdefiniert as IstBenut4_0_, transportd1_.Name as Name0_, transportd1_.ID_Transportmitteltyp as ID_Trans6_0_, transportd1_.Ausmustern as Ausmustern0_, transportd1_.Sortierschluessel as Sortiers8_0_, employee2_.Version as Version1_, employee2_.ID_Adresse as ID_Adresse1_, employee2_.Nachname as Nachname1_, employee2_.Geburtsname as Geburtsn5_1_, employee2_.Vorname as Vorname1_, employee2_.Kurzname as Kurzname1_, employee2_.Spitzname as Spitzname1_, employee2_.IstWeiblich as IstWeibl9_1_, employee2_.Geburtsdatum as Geburts10_1_, employee2_.TelFest as TelFest1_, employee2_.TelMobil as TelMobil1_, employee2_.Email as Email1_, employee2_.Bis as Bis1_, employee3_.Version as Version2_, employee3_.ID_Adresse as ID_Adresse2_, employee3_.Nachname as Nachname2_, employee3_.Geburtsname as Geburtsn5_2_, employee3_.Vorname as Vorname2_, employee3_.Kurzname as Kurzname2_, employee3_.Spitzname as Spitzname2_, employee3_.IstWeiblich as IstWeibl9_2_, employee3_.Geburtsdatum as Geburts10_2_, employee3_.TelFest as TelFest2_, employee3_.TelMobil as TelMobil2_, employee3_.Email as Email2_, employee3_.Bis as Bis2_ from OT_Transportvorgang transportp0_, OTT_Transportmittel transportd1_, OTM_Mitarbeiter employee2_, OTM_Mitarbeiter employee3_ where transportp0_.ID_Transportmittel=transportd1_.ID and transportp0_.ID_Mitarbeiter_Fahrer=employee2_.ID and transportp0_.ID_Mitarbeiter_Beifahrer=employee3_.ID
**************************************
[/code]