Hit the wrong reply and didn't Cc: the list on this.
Of course if this is boring, somebody tell me to shut up.

> Sorry, I simply do not buy that DBCP dynamically instantiates a new 
> datasource when you lookup against an unbound name! There is a 
> connection pool already configured, and a reference already bound to 
> JNDI. Clearly.
> 
> AFAIK, the correct behavior if I attempt to lookup() an unbound name is 
> always an exception.

See the last line of this snippet. Creating a new instance of the desired
type of object is essentially the first thing BasicDataSourceFactory does.
(commons-dbcp-1.1/src/java/org/apache/commons/dbcp/BasicDataSourceFactory.java)

    public Object getObjectInstance(Object obj, Name name, Context nameCtx,
                                    Hashtable environment)
        throws Exception {

        // We only know how to deal with <code>javax.naming.Reference</code>s
        // that specify a class name of "javax.sql.DataSource"
        if ((obj == null) || !(obj instanceof Reference)) {
            return (null);
        }
        Reference ref = (Reference) obj;
        if (!"javax.sql.DataSource".equals(ref.getClassName())) {
            return (null);
        }

        // Create and configure a BasicDataSource instance based on the
        // RefAddr values associated with this Reference
        BasicDataSource dataSource = new BasicDataSource();



Also, the simple Tomcat example, which admittedly is simple,
but the Tomcat docs have no mention of another way to create the object.

 public Object getObjectInstance(Object obj,
      Name name, Context nameCtx, Hashtable environment)
      throws NamingException {

      // Acquire an instance of our specified bean class
      MyBean bean = new MyBean();



In neither case are they caching already bound names or looking them
up in a HashMap like Hibernate does.

I can believe you know alot more about this stuff than I do,
that's why I started the discussion. But unless the ObjectFactory
creates an object, it won't work in Tomcat.

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