package sample;

import java.util.List;

import org.hibernate.SessionFactory;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class SampleController {

	private SessionFactory sessionFactory;

	public SampleController(SessionFactory sessionFactory) {
		this.sessionFactory = sessionFactory;
	}

	@RequestMapping("/")
	@Transactional
	public List<SampleEntity> home() {
		return this.sessionFactory.getCurrentSession()
				.createQuery("from SampleEntity se")
				.list();
	}

}

@@ -492,16 +492,33 @@
 actional
+(readOnly = true)
 %0A%09public

Use readonly transactions where possible