I have two entity class Category and Events.I need to join both the tables and fetch all records which matching the given condition
Ty this below code
public List getCategoryList(int id) throws SQLException, ClassNotFoundException, IOException { Session session = sessionFactory.getCurrentSession(); return session.createCriteria(Catagory.class) .setFetchMode("events", FetchMode.JOIN) .add(Restrictions.eq("parentCatagoryId", 1)) .list(); }
Hope this stuff works.