This now sounds substantially more complex than my design (which uses @PersistenceContext(unitName="accounts")) caters for. Is there an example of what you mean somewhere so I can scope the work out?
Thanks James On 1 July 2013 12:44, Romain Manni-Bucau <[email protected]> wrote: > Hi > > it depends your config and that's probably more an openjpa question but > basically you'll need to provide the dictionnary to use since openjpa will > not be able to read database metadata (at least). > > *Romain Manni-Bucau* > *Twitter: @rmannibucau <https://twitter.com/rmannibucau>* > *Blog: **http://rmannibucau.wordpress.com/*< > http://rmannibucau.wordpress.com/> > *LinkedIn: **http://fr.linkedin.com/in/rmannibucau* > *Github: https://github.com/rmannibucau* > > > > 2013/7/1 James Green <[email protected]> > > > I've suppressed the RuntimeExceptions encountered as EJBs fire and access > > JPA, however I have a new problem now: > > > > Caused by: <openjpa-2.2.0-r422266:1244990 nonfatal user error> > > org.apache.openjpa.persistence.ArgumentException: An error occurred while > > parsing the query filter "SELECT a FROM Account a". Error message: The > name > > "Account" is not a recognized entity or identifier. Known entity names: > [] > > > > It seems the JPA component was unable to map my @Entity classes because > the > > connection did not exist at startup. What do I need to do to work around > > this? > > > > > > > > On 1 July 2013 12:07, Romain Manni-Bucau <[email protected]> wrote: > > > > > yep > > > > > > > > > basically get injected the timerservice ( > > > http://docs.oracle.com/javaee/6/api/javax/ejb/TimerService.html), in > > your > > > init method you try to get your data, if not trigger a later > > > invocation ( > > > > > > http://docs.oracle.com/javaee/6/api/javax/ejb/TimerService.html#createSingleActionTimer(java.util.Date > > > , > > > javax.ejb.TimerConfig)). While it fails trigger another one when > invoked. > > > When it succeeds you are done. > > > > > > *Romain Manni-Bucau* > > > *Twitter: @rmannibucau <https://twitter.com/rmannibucau>* > > > *Blog: **http://rmannibucau.wordpress.com/*< > > > http://rmannibucau.wordpress.com/> > > > *LinkedIn: **http://fr.linkedin.com/in/rmannibucau* > > > *Github: https://github.com/rmannibucau* > > > > > > > > > > > > 2013/7/1 James Green <[email protected]> > > > > > > > In our case we have two EJBs, both @Singleton and @Startup, one > depends > > > on > > > > the other. One is a cache façade and the other loads data via JPA and > > > feeds > > > > it into the cache. An external schedule fires a servlet that reloads > > the > > > > cache from the database. > > > > > > > > What's happening is that without MySQL we see EJB exceptions that > they > > > > cannot be created and thus we are dead. > > > > > > > > I've just tried adding autoReconnect=true inside a <Resource> but > that > > > made > > > > no difference. I also tried adding ,autoReconnect=true to > > > > ConnectionProperties and ConnectionFactoryProperties without any > change > > > but > > > > I'm not convinced that would have fixed the problem here. > > > > > > > > Is it instead the case that within the EJB I should be trapping > > > > connectivity problems such as PersistenceException and allowing the > > > > containing to gracefully start up and naturally keep trying anyway? > > > > > > > > James > > > > > > > > > > > > > > > > On 28 June 2013 17:10, José Luis Cetina <[email protected]> > wrote: > > > > > > > > > I had a similar problem and what i did was set the autoReconnect > > > > attribute > > > > > to true en my tomee.xml datasource. > > > > > What do you mean with retry until the connection springs to life? > do > > > you > > > > > have some schedules or jobs running and want to retry again when > the > > > > > connection is available again? or just want when somebody click any > > > > button > > > > > the app can connect again (this was my case)?? > > > > > > > > > > > > > > > 2013/6/28 Romain Manni-Bucau <[email protected]> > > > > > > > > > > > With an ejb timer? > > > > > > Le 28 juin 2013 17:46, "James Green" <[email protected]> > a > > > > écrit > > > > > : > > > > > > > > > > > > > Hopefully a quick one. > > > > > > > > > > > > > > On boot our application attempts to read data through a JPA > > > > > > EntityManager. > > > > > > > If the database connection fails at this point the entire > > > application > > > > > is > > > > > > > effectively dead. > > > > > > > > > > > > > > Is there a way to essentially ask the database layer to retry > > until > > > > the > > > > > > > connection springs to life? > > > > > > > > > > > > > > Thanks, > > > > > > > > > > > > > > James > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > ------------------------------------------------------------------- > > > > > *SCJA. José Luis Cetina* > > > > > ------------------------------------------------------------------- > > > > > > > > > > > > > > >
