You must first decide when you consider two MyObject instances to be equal, in terms of their properties, and then execute a query.
For example, let's say you have a Country entity with an ID, a name, and a currency. Two countries can be considered equal if they have the same name. But if you have a Person entity, it could be the combination of their name, firstName, date of birth and place of birth that make them functionnally equal.
To continue with my Country example, here's how to perform a query :
String hql = "select Country c where c.name = :theName";
Query q = session.createQuery(hql);
q.setString("theName", theCountryIWantToSave.getName());
Country c = query.uniqueResult();
if (c != null) {
// a country with the same name as theCountryIWantToSave already exists
}
That's pretty basic stuff, really. You should read the Hibernate user guide.