out-of-container JNDI

From: Jon Sharp (jo..ampgroundautomation.com)
Date: Fri Jul 04 2008 - 10:32:17 EDT

  • Next message: Marcin Skladaniec: "estimating proper object cache size"

    Hey guys,

    I'm using Cayenne 3.0M3, and have been using JNDI to get my
    datasource. This works just fine when deploying our app to our
    Glassfish container, as we have our JNDI resource defined there.
    However, we are now attempting to do some JUnit testing of our data
    access layer and therefore need to provide a JNDI reference out-of-
    container. I've found this helpful blog entry by Randy Carver:

    http://blogs.sun.com/randystuph/entry/injecting_jndi_datasources_for_junit

    and it really seemed to address our issue. It seems to get us close,
    but Cayenne doesn't seem to pick up on our "jdbc/sunrise" reference.
    (this matches the reference in our Cayenne data map.) It attempts to
    find a resource by using the modeler user preferences, instead. The
    JNDI docs I found relating to Cayenne seemed to be for 1.2, so I don't
    know how relevant they still are. They seem to indicate that Cayenne
    will look for the "default" provider first, then the user prefs. My
    question is, do we need to do anything else in our JUnit setup method
    to make our "jdbc/sunrise" reference the "default"?

    Does anyone do out-of-container JUnit testing with Cayenne and JNDI?

    Thanks,
    Jon

    --
    Jon Sharp
    CTO & Senior Engineer
    Campground Automation Systems, Inc.
    jo..ampgroundautomation.com
    (615) 579-5868
    www.campgroundautomation.com
    



    This archive was generated by hypermail 2.0.0 : Fri Jul 04 2008 - 10:48:56 EDT