Session session = openSession();
session.beginTransaction();
session.createQuery( "from Animal" ).list();
session.createQuery( "select a from Animal as a" ).list();
session.createQuery( "select a.mother from Animal as a" ).list();
session.createQuery( "select m from Animal as a inner join a.mother as m" ).list();
session.createQuery( "select a from Animal as a inner join fetch a.mother" ).list();
session.createQuery( "from Animal as a where a.description = ?" ).setString( 0, "jj" ).list();
session.createQuery( "from Animal as a where a.description = :desc" ).setString( "desc", "jr" ).list();
session.createQuery( "from Animal as a where a.description = ? or a.description = :desc" )
.setString( 0, "jj" )
.setString( "desc", "jr" )
.list();
session.getTransaction().commit();
session.close();