You need to implement some form of session management to ensure you stick to the basic rules:
1. open session
2. start transaction
3. do your work
4. commit transaction
5. close session
What you did was this:
open session1
do work
open session2
do work on session1's objects
How you manage your sessions depends very much on your environment: standalone, app server, spring, etc. Check out 1.2.5 in the the tutorial for basic management using HibernateUtil.
http://www.hibernate.org/hib_docs/v3/reference/en/html/tutorial.html