Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: hibernate 4 application java swing
PostPosted: Wed Apr 12, 2017 6:47 pm 
Newbie

Joined: Wed Apr 12, 2017 6:39 pm
Posts: 2
j'ai réalisé une application java swing et mysql avec hibernate.
Seulement lorsque je lance deux instance de l'application, les modifications réalisées sur la base de données ne sont pas perçues directement par l'autre instance de l'application.

exemple. dans la premiere instance le modifie la valeur d'un enregistrement.
lorsque j'interroge ce même enregistrement sur l'autre instance, la mise à jour n'est pas perceptible jusqu'à ce que je ferme cette instance et que je la réexécute à nouveau.
vice-versa.
Je suppose que c'est un problème de configuration.
Merci


Top
 Profile  
 
 Post subject: Re: hibernate 4 application java swing
PostPosted: Thu Apr 13, 2017 12:53 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1515
This behavior can be explained if you didn't commit the transaction on the first application. Read this article to know how MVCC works in modern RDBMS, and also this one about ACID transactions.

_________________
If you liked my answer, you are going to love my High-Performance Java Persistence book and my blog as well.


Top
 Profile  
 
 Post subject: Re: hibernate 4 application java swing
PostPosted: Thu Apr 13, 2017 4:47 am 
Newbie

Joined: Wed Apr 12, 2017 6:39 pm
Posts: 2
j'ai bel et bien fait un commit transaction
tx = session.beginTransaction();


tx.commit();
lorsque je recharge mon jtable sur l'instance à partir de la quelle j'ai réalisé la mise à jour, celle-ci est visible.
mais lorsque je recharge mon jtable sur la seconde instance, aucune mise à jour visible.


Top
 Profile  
 
 Post subject: Re: hibernate 4 application java swing
PostPosted: Thu Apr 13, 2017 5:13 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1515
And if you open an SQL console or the SQL Browser, are you able to see the firsts transaction changes? If you can't, it means that they haven't been committed.

_________________
If you liked my answer, you are going to love my High-Performance Java Persistence book and my blog as well.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.