• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Junilu Lacar
  • Martin Vashko
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Scott Selikoff
  • salvin francis
  • Piet Souris

getHibernateTemplate()

 
Ranch Hand
Posts: 662
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hai,
How does getHibernateTemplate() work?
In my DAO I really don't specify any path where my Spring-Hibernate.config.xml is?

On googling I found that getHibernateTemplate() method reads the Session parameters from the beans in ApplicationContext. How exactly does that it read the details from my xml file without knowing it's location?
[ December 22, 2005: Message edited by: Arun Kumarr ]
 
Ranch Hand
Posts: 451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It doesn't need to. That is the job of Hibernate's SessionFactory which produces the Hibernate Sessions that HibernateTemplate uses.
 
Arun Kumarr
Ranch Hand
Posts: 662
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I use hibernate with Springs.
Thanks a lot for the reply.

I tried to instantiate My DAO using new, instead of asking Spring to get it.
Now when java gets it doesn't set the properties of the My DAO, say the "sessionFactory".
It was working fine then.
[ January 05, 2006: Message edited by: Arun Kumarr ]
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to use struts+hibernate+spring.I am encorporating spring thru' hibernateDAOSupport and applicationContext.xml file.Else flow of struts remains the same.
The problem am facing is the getHibernateTemplate() method is returning null even if i wrote the bean of DAO correctly pointing to hibernateTemplate in applicationContext.xml file. I think server is not loading the this context file.
So wt to do ? in web.xml any changes needed?
 
Ken Krebs
Ranch Hand
Posts: 451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's hard to tell what's going on without seeing your applicationContext.xml file.
 
I'm not dead! I feel happy! I'd like to go for a walk! I'll even read a tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!