hibernate inner join question
I have a question in hibernate HQL query with HQL. I have two entities one is Notes and other is NotesEmp class which has one to one relation ship. my notes class looks like the following
class Notes{
private BigDecimal noteId;
private String notes;
@Id
@Column
@GenericGenerator
public BigDecimal getNoteId() {
return noteId;
}
public void setNoteId(BigDecimal noteId) {
this.noteId = noteId;
}
@Lob
@Column
public String getNote() {
return note;
}
public void setNote(String note) {
this.note = note;
}
}
where as the other entiry looks like the following
public class PfmNote implements Serializable{
private BigDecimal noteId;
private String accountId;
private String noteType;
@OneToOne(cascade = CascadeType.ALL)//one to one relation ship with Note
@JoinColumn
public Notes getNote() {
return note;
}
public void setNote(Notes note) {
this.note = note;
}
//with other columsn with setter and gretter method
}
Now i have an HQL query in my configuration file which looks like the following
<query name="getETNoteForPortfolio">
<![CDATA[ from packagename.Notes n,packagename.开发者_JS百科PortfolioNote p
where n.noteId=p.noteId and n.noteId=:noteId]]>
</query>
Now
getHibernateTemplate().findByNamedQueryAndNamedParam("getETNoteForPortfolio",
"noteId",
new BigDecimal(noteId));
which is returning a list of obeject... How can we iterate the list and get al the entires from there. I would really appreciate if some one have any suggesiton.
Thanks in advance
精彩评论