John et al, Please note that this new code module added added as a part of Middlegen 2.1 we are working on at the moment. Its an improvement on the old demo application that had an EJB backend that we have supplied with previous versions of the tool. Since this is only in CVS it is likely to not be working totally correctly at this point. That being said any issues being reported are very helpful. The middlegen dev list might have been a better place to direct your concerns.
Thanks, Cheers David. ----- Original Message ----- From: "John J. Allison" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Wednesday, April 07, 2004 9:34 AM Subject: Re: [Hibernate] SessionFactoryObjectFactory (Tomcat & JNDI) > > How about giving us a hint what was wrong with the existing > > implementation. No-one else has ever complained. > > Sure, sorry. > The code generated by Middlegen is doing this: > > net.sf.hibernate.SessionFactory factory = > (net.sf.hibernate.SessionFactory)ctx.lookup("java:comp/env/AirlineHibernateF actory"); > net.sf.hibernate.Session session = factory.openSession(); > > But that just results in a null being returned and the log file messages: > > 2004-04-02 15:55:43 Apr 2, 2004 3:55:43 PM net.sf.hibernate.impl.SessionFactoryObjectFactory getInstance > WARNING: Not found: Shareable > > Poking around, I noticed that SessionFactoryObjectFactory never > actually creates a SessionFactory. When getObjectInstance() is > called, that's what Tomcat expects - for a SessionFactory instance > to be created. > > The only place a SessionFactoryObjectFactory seems to be deal with > an actual SessionFactory instance is when SessionFactoryImpl calls > SessionFactoryObjectFactory.addInstance(). But when Tomcat calls > getObjectInstance() there is no SessionFactoryImpl around. Tomcat > expects SessionFactoryObjectFactory to create what it needs to. > > Maybe nobody else has complained since they've bitten the bullet > and are creating and configuring hibernate directly. > I have not found on the Hibernate website or this list's archives, > or anywhere, a solution using Resource/ResourceParms in one's > Context element for Tomcat. If I am missing something, please tell me. > > My BasicSessionFactoryObjectFactory makes Tomcat work without > changing the simple Middlegen style of code, or having to manage > a SessionFactory in your applicaton context (to e.g. use the singleton > HibernateSession), and without the problems of JndiSessionFactoryImpl, > both noted on: > http://www.hibernate.org/114.html > > Perhaps JndiSessionFactoryImpl could have been modified to work, but I > chose to work with SessionFactoryObjectFactory. > > Make sense? What am I missing? > > John Allison > [EMAIL PROTECTED] > > > ------------------------------------------------------- > This SF.Net email is sponsored by: IBM Linux Tutorials > Free Linux tutorial presented by Daniel Robbins, President and CEO of > GenToo technologies. Learn everything from fundamentals to system > administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click > _______________________________________________ > hibernate-devel mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/hibernate-devel > ------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click _______________________________________________ hibernate-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hibernate-devel