Hibernate and c3p0 errors
I have spent most of the afternoon battling various “Hibernate”:http://www.hibernate.org or “c3p0″:http://www.mchange.com/projects/c3p0/index.html errors. The biggest was with c3p0.
I wanted to change my application over from using Hibernate’s JDBC connection pooling (which is not for production) to using c3p0. So I added the correct lines to my Hibernate.cfg.xml file and everything broke. I have a JUnit test set up for testing my PersistenceDao class against a real database and not a single test was passing. The problem was that once it came time to run my tests, Hibernate could not open any connections.
I searched Google and found nothing usefull. In the end the solution came from playing around with the config file. I commented out the following line:
update
And all of my tests started to pass. Cool. I just wish I understand why that one line made such a difference. I am expecting that I will have problems with this down the road. The solution cannot be that simple.
Now the problem that I am trying to fix is that when I run app in Tomcat, the lazy loading isn’t working. The error message keeps saying that it can’t create a proxy, even though I have lazy loading turned off. It should be eagerly fetching all of my collections, but it ain’t. Time to check Google again.