cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrus Adamchik <>
Subject Re: out-of-container JNDI
Date Sat, 05 Jul 2008 10:46:12 GMT
Hi Jon,

Cayenne looks up stuff in Modeler preferences only AFTER it fails the  
normal JNDI lookup (this is the same across 1.2, 2.0, and 3.0  
versions). So there should be something in your config that prevents  
JNDI from working. So a question - can you obtain a DataSource  
instance bypassing Cayenne from within a unit test?


On Jul 4, 2008, at 5:32 PM, Jon Sharp wrote:

> 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?
> Thanks,
> Jon
> --
> Jon Sharp
> CTO & Senior Engineer
> Campground Automation Systems, Inc.
> (615) 579-5868

View raw message