Specifying join condition "ON columns" in hibernate HQL?
<p>I am learning Hibernate, and I have a question about basic HQL join syntax. I am following this <a href="http://www.codejava.net/frameworks/hibernate/hibernate-query-language-hql-example" rel="nofollow">tutorial</a>. Say I have a Product and Category entity,</p>

<pre><code>@Entity
@Table(name = "CATEGORY")
public class Category {

    private long id;
    private String name;

    private Set&lt;Product&gt; products;

    public Category() {
    }

    public Category(String name) {
        this.name = name;
    }

    @Id
    @Column(name = "CATEGORY_ID")
    @GeneratedValue
    public long getId() {
        return id;
    }


    @OneToMany(mappedBy = "category", cascade = CascadeType.ALL)
    public Set&lt;Product&gt; getProducts() {
        return products;
    }

    // other getters and setters
}
</code></pre>

<hr>

<pre><code>@Entity
@Table(name = "PRODUCT")
public class Product {
    private long id;
    private String name;
    private String description;
    private float price;

    private Category category;

    public Product() {
    }

    public Product(String name, String description, float price,
            Category category) {
        this.name = name;
        this.description = description;
        this.price = price;
        this.category = category;
    }

    @Id
    @Column(name = "PRODUCT_ID")
    @GeneratedValue
    public long getId() {
        return id;
    }

    @ManyToOne
    @JoinColumn(name = "CATEGORY_ID")
    public Category getCategory() {
        return category;
    }

    // other getters and setters
}
</code></pre>

<p>So I have to join category and Product, I will something like this in sql</p>

<pre><code>select * from Category A inner join Product B on A.id=B.category_id,
</code></pre>

<p>In HQL, it seems we drop the "on" condition, the HQL for the above query is</p>

<pre><code>String hql = "from Product p inner join p.category";

Query query = session.createQuery(hql);
</code></pre>

<p>Why is on not required in HQL?</p>