• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Hibernate SessionFactory Problem

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
I will suppress my every urge. But not this shameless plug:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic