Quote:
here Hibernate creates a new session when first time database access is needed (if there is no old created session). but now i want some help to intregate Hibernate with Tomcat to create the session during Tomcat startup
Do you mean session or session factory? You would want to create your session factory once and then use sessions as per the patterns below.
There are several well documented patterns for integrating hibernate with a web container (open session in view, thread local session, disconnected session etc). You should select the one most appropriate based on your architecture.
Personally I have found the open session in view pattern (using a filter to open/close sessions) easy to use in smaller web applications where the domain model is shared between all layers of the system.
Perhaps you should try this one out. It also circumvents many of the faq type problems that people often stumble upon (lazily initialisation etc)
Regards
Justin