Authored by csgyoho

grass-syn-transaction

@@ -191,7 +191,9 @@ public class YohoNowDataSynService { @@ -191,7 +191,9 @@ public class YohoNowDataSynService {
191 needSyncList.add(articleLabel); 191 needSyncList.add(articleLabel);
192 }); 192 });
193 } 193 }
194 - publicEntityManager.getTransaction().begin(); 194 + if(!publicEntityManager.getTransaction().isActive()){
  195 + publicEntityManager.getTransaction().begin();
  196 + }
195 StringBuilder sb = null; 197 StringBuilder sb = null;
196 for(PublicArticleLabel attention : needSyncList){ 198 for(PublicArticleLabel attention : needSyncList){
197 if(null == sb ){ 199 if(null == sb ){
@@ -208,7 +210,9 @@ public class YohoNowDataSynService { @@ -208,7 +210,9 @@ public class YohoNowDataSynService {
208 } 210 }
209 211
210 private void savePublicLabels(List<PublicLabel> needSyncLabelList){ 212 private void savePublicLabels(List<PublicLabel> needSyncLabelList){
211 - publicEntityManager.getTransaction().begin(); 213 + if(!publicEntityManager.getTransaction().isActive()){
  214 + publicEntityManager.getTransaction().begin();
  215 + }
212 StringBuilder sb = null; 216 StringBuilder sb = null;
213 for(PublicLabel attention : needSyncLabelList){ 217 for(PublicLabel attention : needSyncLabelList){
214 if(null == sb ){ 218 if(null == sb ){
@@ -409,7 +413,9 @@ public class YohoNowDataSynService { @@ -409,7 +413,9 @@ public class YohoNowDataSynService {
409 } 413 }
410 414
411 private void savePublicUserAttentions(List<PublicUserAttention> userAttentions){ 415 private void savePublicUserAttentions(List<PublicUserAttention> userAttentions){
412 - publicEntityManager.getTransaction().begin(); 416 + if(!publicEntityManager.getTransaction().isActive()){
  417 + publicEntityManager.getTransaction().begin();
  418 + }
413 StringBuilder sb = null; 419 StringBuilder sb = null;
414 for(PublicUserAttention attention : userAttentions){ 420 for(PublicUserAttention attention : userAttentions){
415 if(null == sb ){ 421 if(null == sb ){
@@ -505,7 +511,9 @@ public class YohoNowDataSynService { @@ -505,7 +511,9 @@ public class YohoNowDataSynService {
505 } 511 }
506 512
507 private void savePublicUserPraises(List<PublicUserPraise> articlePraises){ 513 private void savePublicUserPraises(List<PublicUserPraise> articlePraises){
508 - publicEntityManager.getTransaction().begin(); 514 + if(!publicEntityManager.getTransaction().isActive()){
  515 + publicEntityManager.getTransaction().begin();
  516 + }
509 StringBuilder sb = null; 517 StringBuilder sb = null;
510 for(PublicUserPraise attention : articlePraises){ 518 for(PublicUserPraise attention : articlePraises){
511 if(null == sb ){ 519 if(null == sb ){