Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version: 3.1.2
Mapping documents:
Code:
<hibernate-mapping>
<class name="Role" table="role" node="Role">
<id name="id" type="long" column="id" unsaved-value="0" node="@id">
<generator class="sequence">
<param name="sequence">role_id_seq</param>
</generator>
</id>
<version node="@version" name="version" type="long" access="field" unsaved-value="undefined" />
<property node="@changePerson" name="changePerson" type="string" column="changePerson" not-null="true" />
<property node="@changeDate" name="changeDate" type="calendar" column="changeDate" not-null="true" />
<property node="@creationDate" name="creationDate" type="calendar" column="creationDate" not-null="false" />
....
<joined-subclass name="Customer" lazy="false" node="Customer">
<key column="pk_personrole" />
...
</joined-subclass>
<joined-subclass name="Driver" node="Driver">
<key column="pk_personrole" />
<!-- one Driver belongs to one DriverClass -->
<many-to-one name="customer" node="Customer/@id" class="Customer" column="ref_customer" />
</joined-subclass>
...
</class>
</hibernate-mapping>
Name and version of the database you are using: Postgres 8.2
The generated SQL (show_sql=true):
Hi,
we have Problems using (right) joins with HQL.
Let's consider two classes, "Customer" and "Driver", they are mapped as above, the driver has a reference to the customer. Now we want to write a query that list all customers and, if there are any, the drivers that are referenced.
Thought it's a right join, so we queried like this:
Quote:
select _customer0.partner, _driver0.partner from de.innuce.masterdata.person.Driver _driver0 right join _driver0.customer _customer0
In our example db we have three customers, just one has a driver. So, we expected three rows returned.
Just got one, the one customer which is referenced by the only driver.
Are we doing sth. wrong, or is HQL right join behaving different than ANSI?
Thanks a lot.[/quote]