Quote:
.But ,when I am trying to select parent object, I am getting the child objects also
This depends on how you define the relation, if you define it EAGER or LAZY.
Quote:
If I want to get only one object depending on my criteria,what should I do.
If you have defined a relation EAGER and if regardsless of this,
you want that regarding property is not loaded too (join query) when you execute a query by criteria,
then you must use the FetchMode.SELECT before execting the query.
Code:
Criteria crit = _nativeSession.createCriteria(MyChild.class);
crit.add(Restrictions.eq("name",name));
...
crit.setFetchMode("relationParent", org.hibernate.FetchMode.SELECT);