> Ummmm ... as per the Hibernate documentation:
> 
> new Configuration().configure().buildSessionFactory()
> 
> will instantiate a SessionFactory and bind its Reference to JNDI and 
> register it with the ObjectFactory.
> 

It works by calling "new SessionFactoryImpl" which calls
SessionFactoryObjectFactory.addInstance().
But how is Tomcat going to create a Configuration object?
It only knows ObjectFactorys. SessionFactoryObjectFactory never
creates a Configuration. That's exactly the code I added
to make BasicSessionFactoryObjectFactory: calls to create
a Configuration and then buildSessionFactory().

SessionFactoryObjectFactory is the only ObjectFactory in Hibernate.
Configuration is not an ObjectFactory. There is no ConfigurationObjectFactory.
(And there shouldn't be; what Tomcat really wants is a SessionFactory
not a Configuration.)

I guess this all works perfectly in other containers, but Tomcat
needs the ObjectFactory to actually create an object, like
org.apache.commons.dbcp.BasicDataSourceFactory does.

Maybe this doesn't belong in SessionFactoryObjectFactory, because
it's used differently by other containers, but for Tomcat, Hibernate
needs to supply an ObjectFactory that creates the objects it
says it will return. JndiSessionFactoryImpl on page 114 does this
but is incomplete (also via Configuration.buildSessionFactory()).
I saw that and the problems listed and then notice SessionFactoryObjectFactory
and thought it was supposed to be the official ObjectFactory.
Perhaps my additions to SessionFactoryObjectFactory should be
additions to JndiSessionFactoryImpl, but I still think they should
be a part of Hibernate.

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

Reply via email to