| 
					
						 Hi I used a criteria to join two tables and the following sql was executed.
  select a.id as id,  a.details as details, event2_.EVENT_ID as EVENT1, event2_.ASSET as ASSET2_28_0_, event2_.SCORE as SCORE28_0_, event3_.EVENT_ID as EVENT2, riskevent3_.ASSET as ASSET2_28_1_, event3_.SCORE as SCORE28_1_ from ORDERHISTORY a, EVENT event2_, EVENT event3_ where a.EVENT_ID=event2_.EVENT_ID(+) and event2_.PARENT_EVENT_ID=event3_.EVENT_ID(+) and a.ORDER_ID=?
  As Iam using Criteria I do not want to include any columns related to event3 and do want to include condition "event2_.PARENT_EVENT_ID=event3_.EVENT_ID(+)".
  Here is my Criteria Criteria criteria = session.createCriteria(OrderHistory.class);
  criteria.add(Restrictions.eq("OrderId", "1124")); 				 criteria.setFetchMode("B", FetchMode.JOIN);
 
  Class History {  @ManyToOne 	@JoinColumn(name="EVENT_ID") 	private Event event; ..... other columns }
  Class B {
  @ManyToOne 	@JoinColumn(name="EVENT_ID") 	private Event event; .... Other columns }
 
  Class Event {
  @ManyToOne 	@JoinColumn(name="PARENT_EVENT_ID")     private Event event;
  ..... Other columns here...
  }
 
  The problem is in Event class i have reference to same Event as parent id. So my query is by using criteria can we ignore the event3 related conditions and columns. 
					
  
						
					 |