Hibernate SessionFactory: how to configure JNDI in Tomcat?

Posted by EugeneP on Stack Overflow See other posts from Stack Overflow or by EugeneP
Published on 2010-03-19T08:44:01Z Indexed on 2010/03/19 9:11 UTC
Read the original article Hit count: 267

Filed under:
|
|
|
|

that's how the session factory should be gotten:

    protected SessionFactory getSessionFactory() {
        try {
            return (SessionFactory) new InitialContext()
                    .lookup("SessionFactory");
        } catch (Exception e) {
        }
    }

Please provide a simple solution for Tomcat6 to be able to get SessionFactory thru simple jndi lookup in Java code. What should be written in what file on the side of Tomcat ?

© Stack Overflow or respective owner

Related posts about java

Related posts about tomcat