christian wrote:
It seems you are really stuck at a very early stage. I recommend Hibernate in Action if all the other documentation doesn't make sense for you.
I'm going through the book now...it's what is spawning my questions.
Yes, I'm at an early stage...in java/struts/hibernate development. I'm not a new developer, as I've been developing applications since 1983. But to struts/hibernate -- yes, I'm new.
But I'm not stupid, slow or lazy.
And I've paid for the book, and I'm reading it...the second of hibernate books I've purchased...having already read "Hibernate: A Developer's Handbook".
And yes, I've downloaded and am reading through the CaveatEmptor sample code.
Now, back to my question. As I've said, currently I have hibernate working....CRUD screens in a web app built with the struts framework.
But the code I currently use -- opens and closes a Connection and ServiceFactory in every DAO method.
I'm looking for a better way to integrate with struts. The eBook suggests using only a single SessionFactory and I'm trying to figure out how to accomplish this.
Reading through the book (Chapter 2), I notice that there are a couple ways to achieve this...one of them is the Singleton pattern.
Which triggered something in my memory, so I went to my Struts book, looked up the Singleton design pattern....and then went to the Hibernateutility to see if I could convert it.
Low and behold, the HibernateUtility is already written as a singleton. Since it uses static variables to hold the Configuration/SessionFactory objects...it won't be creating them new each time I call it.
So...am I correct in understanding that if I use the HibernateUtility -- with the HibernateFilter.....I'm all set?
No need for the Hibernate plugin? No need for JNDI (for this purpose)?
Lee