]
Steve Ebersole closed HHH-1286.
-------------------------------
Closing stale resolved issues
Set entity in HQL query without prefix -> incorrect SQL
-------------------------------------------------------
Key: HHH-1286
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-1286
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.1
Environment: PostgreSQL 8.0.1
Reporter: Ronald Wildenberg
Assignee: Steve Ebersole
Priority: Minor
Fix For: 3.1.1
Attachments: hibernate.cfg.xml, model.zip
Suppose two entities: Term and Indeling with:
Term.java:
private Indeling indeling;
@ManyToOne(cascade = { CascadeType.REFRESH }, optional = false, fetch =
FetchType.EAGER)
@JoinColumn(name = "indeling_id")
public Indeling getIndeling() {
return indeling;
}
Indeling.java:
private Set<Term> termen = new HashSet<Term>();
@OneToMany(mappedBy = "indeling", cascade = { CascadeType.REMOVE })
public Set<Term> getTermen() {
return termen;
}
and a HQL query in package-info.java: "from Term where indeling = :indeling"
Hibernate generates an SQL statement with the following where clause: "where
indeling=?". The join column, however, is indeling_id.
A workaround for this issue is to change the HQL query to: "from Term term where
term.indeling = :indeling", using an alias.
Attached you will find model.zip (with Term.java, Indeling.java and package-info.java)
and hibernate.cfg.xml.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: