StatelessSession Interface
If you want to avoid the high level of hibernate life cycle and the persistance level
then StatelessSession(org.hibernate.StatelessSession) is the solution.It neglects the 1st level and second level of cache.It works similar to org.hibernate.Session .
The link for the Java Doc is this.
{
StatelessSession session = sessionFactory.openStatelessSession(); Transaction tx = session.beginTransaction(); ScrollableResults students = session.createQuery("from STUDENT").scroll(); while ( students.next() ) { Student std = (Student) students.get(0); session.update(std); } tx.commit(); session.close();
}
No comments:
Post a Comment