I'm starting a new project, trying to do things right this time(so more than one question), I might need some help, I'm not sure what I'm doing wrong :
I want to utilize spring MVC as much as possible, how do I make session opening/closing handled by @Transactional?
How do I catch the exceptions(i.e. non existing record or database failed) if any. i.e My database doesn't accept duplicate entries like this one :
com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry
How can I catch this?
And for every next request I make I get this exception :
org.hibernate.AssertionFailure: null id in com.test.spring.ws.service.impl.TestObject entry (don't flush the Session after an exception occurs)
What I'm doing wrong? Can anyone suggest some improvements in my project?