Spring 2.5.6 / Hibernate 3.3.2 / Oracle 10g / hibernate.transaction.factory_class not specified (default value) / HibernateTransactionManager
Code:
@Service("bookService")
@Transactional(propagation = Propagation.REQUIRED)
public class BookServiceImpl implements IBookService {
@Autowired
private IBookDao bookDao; // uses @Autowired SessionFactory
@Transactional(readOnly=true, isolation=Isolation.SERIALIZABLE)
public List<Book> getAllBooks() {
Thread.sleep(20000L); // simulates business code*
return bookDao.getAll();
}
}
If somebody updates several books before bookDao.getAll() is invoked*, then bookDao should return "old book values", instead of returning the new ones. With pure JDBC it works perfectly. But with spring managed transaction it does not work at all. What is the problem ? Do I need to configure something special ?
Spring seems to set correctly the transaction isolation level (I can see it in dao tier). So it the problem seems to come from Hibernate.