cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jon Sharp <>
Subject out-of-container JNDI
Date Fri, 04 Jul 2008 14:32:17 GMT
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:

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?


Jon Sharp
CTO & Senior Engineer
Campground Automation Systems, Inc.
(615) 579-5868

View raw message