I created some code following Nick Heudecker's Introduction to Hibernate tutorial, and nothing happened with my database. The basic code idea was:
Session s = sf.openSession();
s.saveOrUpdate(team);
s.close();
However, if I wrap a Transaction around the saveOrUpdate() and commit it before the session close(), it works.
I got rid of the Transaction and put s.flush() before the s.close() and the database was updated, but in much of the introductory material scattered around the Hibernate website, there are neither Transactions nor Session flushes to be found. Is this a change from previous versions?
So, I guess my questions are:
1) Should I be using Transactions as a matter of course, even for atomic statements?
2) If the answer to (1) is no, do I have to call flush() separately from close(), and, if so, isn't this different from the way Streams and Writers work in the Java classes, and so confusing?
Thanks!
P.S. I followed the Getting Started guide at
http://www.hibernate.org/152.html and almost nothing worked in the way it was advertised. I think the implementation and the documentation have parted ways. I suppose that's fine, but it does make life for newbies quite a bit more difficult.