[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [eclipselink-users] How To modify Eclipselink JPA 2.0 connection retry behaviour for more responsive swing EDT
|
Try this method:
http://www.eclipse.org/eclipselink/api/2.2/org/eclipse/persistence/sessions/DatabaseLogin.html#setQueryRetryAttemptCount(int)
To get to the DatabaseLogin, you will have use a SessionCustomizer from the
table here:
http://wiki.eclipse.org/Using_EclipseLink_JPA_Extensions_%28ELUG%29#How_to_Use_the_Persistence_Unit_Properties_for_Customization_and_Validation
You can access the login through the Session passed into the SessionCustomizer.
(DatabaseLogin)(session.getDatasourceLogin())
-Tom
mohamed jawath wrote:
How To modify Eclipselink JPA 2.0 connection retry behaviour for more
responsive swing EDT
Eclipselink automatically tries to reconnect it self to database whenever it
detects a connection failure this causes swing ui to freeze without any
responses until it connects to database .
Are there any solution to modify this behavior
Ie is it possible to throw exception when connection fails without retrying
Please help on this issue
I am facing with huge problem.
I went throe eclipselink source code and google but I could not find any
solution.
i am using this to develop swing desktop application
local emf bootstrap
i used to create jframe and initialise entity managers and use them for crud
action
EntityManager entityManager =
Persistence.createEntityManagerFactory("mydb").createEntityManager();
//Database connection is connected
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
entityManager.createQuery(".....").getResultList();
}
//if Database connection is disconnected at this point.
// swing gui edt thread will start to hang or freeze in this place..
// because eclipselink is retrying connection for 3 times this is very awful
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
entityManager.createQuery(".....").getResultList();
}
------------------------------------------------------------------------
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users