Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

spring DAO hibernate ORM

Posted on 2011-05-06
3
Medium Priority
?
529 Views
Last Modified: 2012-05-11



I was reading folowing lines. And I did not understand clearly.

Spring’s Hibernate ORM framework also comes with the convenience class HibernateDaoSupport
that your DAO classes can subclass:
public class StudentDaoHibernate extends HibernateDaoSupport
implements StudentDao {

}
If you opt for this design, you need to wire in a SessionFactory—the Hibernate-
DaoSupport class comes with this property. This class provides you with a convenience
method, getHibernateTemplate(), to easily get an instance of a HibernateTemplate.
It also has a getSession() and a closeSessionIfNecessary() method if, for some
reason, you need to perform a Hibernate operation without using a Hibernate-
Template. We are sure you will find these cases will be the exception (no pun
intended). So now you can see how easily you can integrate an ORM tool like
Hibernate.

Any ideas, resources,sample code,links, highly appreciated. thanks in advance.
0
Comment
Question by:gudii9
  • 2
3 Comments
 
LVL 92

Expert Comment

by:objects
ID: 35710937
The HibernateDaoSupport provides  utility methods for make hibernate calls making it a lot simpler for you. To do this it requires a SessionFactory to access the dabaase, so you need to supply this to your dao when you initialise it
0
 
LVL 7

Author Comment

by:gudii9
ID: 35724955
>>need to wire in a SessionFactory—the Hibernate-
DaoSupport class comes with this property.
how do we wire SessionFactory property inside Hibernate-
DaoSupport class in the spring application. please advise
0
 
LVL 92

Accepted Solution

by:
objects earned 2000 total points
ID: 35724997
<bean id="myDao" class="au.com.objects.dao.MyDao">
  <property name="sessionFactory">
    <ref bean="sessionFactory"/>
  </property>
</bean>
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
The viewer will learn how to implement Singleton Design Pattern in Java.
Suggested Courses
Course of the Month15 days, 23 hours left to enroll

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question