views:

323

answers:

1

Req.hbm.xml:

 <id name="reqId" type="long" column="REQ_ID"> 
  <generator class="sequence">
   <param name="sequence">SEQUENCE</param> 
  </generator>
 </id>


 <bag name="lines" lazy="false" >
  <key column="REQ_ID" not-null="true" />
  <one-to-many class="com.Lines" />
 </bag>

Lines.hbm.xml

 <id name="lineId" type="string" column="LINE">
  <generator class="assigned" />
 </id>

 <property name="reqId" type="long" column="REQ_ID" />

  <bag name="comments">
  <key column="LINE" />
  <one-to-many class="com.Comments"/>
 </bag>

Comments.hbm.xml:

Req.java will contain list of lines. and Line.java have list of comments.

While retrieving columns using projections... how can i retrive columns from CMNTS table.

lines.comments.commentId can i use in Projection and can i retrieve the column?

How do define joins in criteria class for CMNTS table?

A: 

No you can't just go "lines.comments.commentId", you need to use a projection alias to traverse multiple collections. Have a look at Projections.alias()

Daniel Alexiuc