public Book findBookByTitle(String title) throws Exception {
    Datastore ds  Hibernate.createDatastore(); 
    ds.storeFile("hibernate.xml");
    SessionFactory sessionFactory = ds.buildSessionFactory(); 
    Session session = sessionFactory.openSession();
    Book book = null;
    List results = session.find("from o in class book.Book where title =
         ?", title, Hibernate.STRING); 
    if (results. isEmpty()) {
        throw new Exception ("Nie znaleziono encji: " + title); 
    } else {
        book = results.get(0);
    }
    session.close(); 
    return book;
}
