I am getting error:
Exception in thread \"main\" org.hibernate.HibernateException:
Could not obtain transaction-synchronized Session for current thread
You must enable the transaction support (
or @EnableTransactionManagement
) and declare the transactionManager and it should work through the SessionFactory.
You must add @Transactional
into your @Repository
With @Transactional
in your @Repository
Spring is able to apply transactional support into your repository.
Your Student class has no the @javax.persistence.*
annotations how @Entity
, I am assuming the Mapping Configuration for that class has been defined through XML.
Ref