Dear ranchers,
I have started a project in my spare time to update my
Java skills but I've reached a bit of a road block. I've been really impressed with spring and hibernate but the transactions are proving a bit tricky. For information I am using the annotation based declarative transactions. I keep getting the following exception when I make an HTTP request that tries to use the hibernate session factory.
I must have spent 8-10 hours so far trying to fix this one and I'm really at my wits end. If you google this exception then most of the solutions are either missing @Transactional or missing <tx:annotation-driven /> from the config. I have both of these already so I don't think this is my problem. Other bits of advice just say to read the manual, I have done this and as far as I can see I am doing everything required.
Here are the relevant bits of code.
The spring context XML looks like this:
This is the XML config for the data layer
Here is the service implementation class. The interface is just a straight interface with no annotations.
Here is my DAO implementation. Again the interface is simple with no annotations.
Finally here is my simple entity.
I've had a look in debug and the sessionFactory is there but its transactionManager property is null. I must be missing something but I've checked countless tutorials etc and can't for the life of me find it. Hopefully someone can help me. Looking forward to your suggestions!
Thanks in advance
Ben