Mark Spritzler wrote:Let's make this a little easier.
1) What benefits do you get from extending a DaoSupport class? To me there is zero benefits, and one small disadvantage of coupling your code. Or if you think there are benefits, there are other ways to get the same benefit just as easy or easier without coupling your code.
Mark
Jeanne Boyarsky wrote:Kevin,
I think Amit's point is relevant. You used to be able to take the cert if you had experience. Now the only way to take it is by taking the course first. And no, I don't think the cert if valuable. I think they dumbed it down too much so it is more like a sign you paid attention in class.
Mark Spritzler wrote:1) No, you create a bean of type LocalSessionFactoryBean or AnnotationSessionFactoryBean to create a bean of type SessionFactory and in that bean set properties to set everything that you had had in the hibernate.cfg.xml
3) You will also need some of the Hibernate jars too.
2. I would have each of your DAO to extend HibernateDaoSupport. That class can has a field called hibernateTemplate which you can use for HQL.
Please please do not do this. If you make your DAO extend HibernateDaoSupport then your DAO is now tightly coupled with Spring. Spring itself does not want you to do this.
In the old days of Hibernate before Hibernate 3.1 and before Spring 2.5.6 this was a good idea. Now it is not, you will not gain anything by extending that class.
Make your DAO have a SessionFactory injected into it yourself. Then in the code call sessionFactory.getCurrentSession() to get a Session to run queries in. There is no more Hibernate boiler plate code to hide to even warrant using the HibernateTemplate.
Mark
scott miles wrote:In most of the sites and books i have read two types os injection in spring that is
1)Constructor injection
2)Setter injection
As per my understanding autowiring is also a type of injection only. Is n't it? am i missing something here.
Amit Sharad wrote:Hi
There is a training that you have to attend, its a 4 full days long training 32 hrs , they do teach you some concepts that may not be covered in a book and then you can appear for an exam and like I mentioned before also by studying for a Core spring certification you would be learning many concepts in deep which eventually add to your knowledge. Even I have also worked on Spring 2x but now preparing for Spring 3x certification exam and I got to know some low level concepts of Spring as it is a very big framework and so many things to learn.
Greg Funston wrote:Hi, I currently use Spring, Hibernate at work. I have never built my own Spring, Hibernate project from the ground up. This is what I am currently trying to do. There is a ton of information out there and I am reading everything I can. However, it is a lot of information and much of it is dated. I will keep reading and investigating to try to achieve my goal.
The Project
I wish to create a project using the spring framework with hibernate. My database of choice is MySQL(mostly because it is loaded and running on my server). I have the newest spring tools downloaded and my final objective is to create a link with hibernate and mysql. I am looking for advice on the best way to do this. My understanding so far is to use spring for most of the work. I welcome all opinions and look forward to the replies.
1. Is a hibernate.cfg.xml file required. If not is all the configuation done in the spring data-access-config.xml file?
2. If I want to use hql to communicate with hibernate and have it connect to SQL how is that best configured?
(My understanding is hibernate will translate to most databases abstracting the database to a jdbc connection).
3. What jar files will be needed to make this work?
Thank You.
Greg Funston