• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JPA EntityManager

 
Ranch Hand
Posts: 1402
3
Netbeans IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I am working with JPA, web services and PostgresSQL.

The thing is that when the service goes down and then restarts, I cant access the database because of a probem with the initialization of the  Entity Manager. It should restart together with the service.


Any idea, please?
 
Angus Ferguson
Ranch Hand
Posts: 1402
3
Netbeans IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The database and the service are down. I start them:
At first I start the service. It gets an exception because the database is not available ( -> thats right behaviour)
Then I start the database.
When I want to access the database we get an exception – because the EntityManager thinks that the database was down when the service was initialized, so it must still be down, even if the database is available (-> thats wrong behaviour: I want to be able to use the database even if it was down when my service started).

Any idea, please?
 
Saloon Keeper
Posts: 27807
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't think that's a JPA issue. If you're running JPA on a webapp, you should be sourcing connections from a server Connection Pool and what I'd expect to be happening is that the pool couldn't supply live Connections while the DBMS was down, but it should be able to as soon as the DBMS comes back up.

You may need to adjust some pool configuration attributes to make that happen properly for you, though.
reply
    Bookmark Topic Watch Topic
  • New Topic