• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate SessionFactory Problem

 
Bob Carpenter
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm a JSP/Struts/JDBC developer starting my first Spring/Hibernate project.

I've read many of the docs and downloaded several examples and got them running. I'm now trying to convert one of the Spring examples to use Hibernate. For those interested, I'm converting the "Spring MVC Fast Tutorial" found at http://maestric.com/doc/java/spring - SpringMVC is #3.

I successfully got the WAR deployed, but it's failing when trying to get the hibernateTemplate from the sessionFactory. During deployment the log shows that the hibernateTemplate was created but later, from my view, when I try to use hibernateTemplate.find( ) the object is null.

So, I guess I have not correctly constructed the bean that creates the sessionFactory and makes it persistent.

I add the relevant code below, but for those that want to see the full project and log you can download it from here: http://carpenterdev.com/files/myspringmvc.zip

Thanks for your help in solving this!

--Bob
 
Bob Carpenter
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm the original poster.

I edited the posting because I pasted the wrong Car.hbm.xml code.

If you read the earlier post and the Car.hbm.xml part didn't make sense, it should now.

Thanks,

--Bob
 
Bob Carpenter
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I decided to give up on using HibernateDaoSupport and instead use a plain hibernate3 api.

This means that in my DAOImpl classes, where I need to get a hibernateTemplate I use an applicationContext to get the sessionFactory bean, like this:


--Bob
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic