This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes Other Application Frameworks and the fly likes getHibernateTemplate() Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Reply Bookmark "getHibernateTemplate()" Watch "getHibernateTemplate()" New topic
Author

getHibernateTemplate()

Arun Kumarr
Ranch Hand

Joined: May 16, 2005
Posts: 508

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 ]

If you are not laughing at yourself, then you just didn't get the joke.
Ken Krebs
Ranch Hand

Joined: Nov 27, 2002
Posts: 451
It doesn't need to. That is the job of Hibernate's SessionFactory which produces the Hibernate Sessions that HibernateTemplate uses.


kktec<br />SCJP, SCWCD, SCJD<br />"What we observe is not nature itself, but nature exposed to our method of questioning." - Werner Heisenberg
Arun Kumarr
Ranch Hand

Joined: May 16, 2005
Posts: 508

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 ]
tejaswini patwardhan
Greenhorn

Joined: Oct 17, 2004
Posts: 3
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

Joined: Nov 27, 2002
Posts: 451
It's hard to tell what's going on without seeing your applicationContext.xml file.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: getHibernateTemplate()
 
Similar Threads
Hibernate is returning proxy objects even if no matching row is found on the database
HibernateTemplate batch Update
How to save and delete the List<Object> by HibernateTemplate?..
Srping+Hibernate bad configurated causing huge memory consumption
RecordNotFoundException thrown by getHibernateTemplate().delete(person)