Hi!
I have some problem with JOIN!
my
Hibernate version is
3
I have two class:
Code:
package pkg;
public class Father {
private int id;
private String name;
public void setId(int id) {this.id = id;}
public int getId() { return this.id;}
public void setName(String name) {this.name = name;}
public String getName() { return this.name;}
}
package pkg;
public class Child extends Father {
private int id;
private String name_child;
public void setId(int id) {this.id = id;}
public int getId() { return this.id;}
public void setName_child(String name_child) {this.name_child = name_child;}
public String getName_child() { return this.name_child;}
}
...and two mapping files:
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="pkg.Father" table="Father"
dynamic-update="true" dynamic-insert="true"
lazy="true" discriminator-value="null">
<id name="id" type="int">
<generator class="native"/>
</id>
<property name="name" />
</class>
</hibernate-mapping>
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="pkg.Child" table="Child" dynamic-update="true" dynamic-insert="true" >
<id name="id" type="int">
<generator class="native"/>
</id>
<property name="name_child" column="name" />
<join table="Father" fetch="join" >
<key column="id"/>
<property name="name" />
</join>
</class>
</hibernate-mapping>
...and this code:
Quote:
session.beginTransaction();
List childi = session.createQuery("from Child").list();
session.getTransaction().commit();
the query generates from hibernate is like this:
Code:
select child.id, child.name_child, father.id, father.name from child left outer join father on child.id=father.id
but i need RIGHT OUTER JOIN, not LEFT OUTER JOIN!
how can i do?
than you
[/quote][/code]