Skip to main content

[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

Set retry attempt count to zero in SessionCustomizer:

        session.getLogin().setQueryRetryAttemptCount(0);


On 3/17/2011 8:51 AM, 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


Back to the top