I am using Spring with Hibernate in my project.
.There are many methods written in DAO implementation java file and every method is using the same try/catch/finally lines of code which seem redundant to me.
I am told to optimize/refactor the code since the file LOC exceeds 10k. I read somewhere that using HibernateDaoSupport we need not to worry about exceptions or closing the session. It will be taken care of by Spring itself. Could somebody please help me how to proceed or do the needful? I am very much new to Spring
I am pasting below code of one method in DAO layer
I personally like to stick with JPA and only resort to vendor (like hibernate) specific stuff when I have to. With that said being forced to extend classes from the framework or the use of templates is a thing of the past. Rather than write and example myself I found a good one that will get you started. I glanced at it and I think he diid a good job covering the hows and whys. Let me know if anything is not clear.