• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Synchronization issue with PreparedStatement

 
Ranch Hand
Posts: 413
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear All
I am facing a strange issue. We have to delete some roles from our application .As per business logic before deletion of roles we store them into ou archive table and once they are stored then we delete them from our main table

This logic works fine with single user environment but whenever testing is performed on multi user we are losing the roleName value of the record and getting exception from table


In our code we are first selecting the record from our main table VT_RE_ROLE
and putting it into dto.closing prepared ststement,resultset

opening another preparedststement and now using same dto tryin to insert this record

Sample code snippet is as follows


Some how the dto's name property is lost and therefore in subsequent preparedstatement it throws the error mentioned above

If any one can share some inputs that will be of great help

 
author & internet detective
Posts: 40211
816
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Gaurav,
I see two inserts without a transaction. Is there a transaction wrapping the whole code (maybe it is called from a session bean or the like) ? If not, all sorts of synchronization/threading issues can occur without a transaction and you should add one.
 
Gaurav Chikara
Ranch Hand
Posts: 413
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah all set of inserts are with in a same transaction
Therefore ideally shall be there any synchrnonization issues?
 
Jeanne Boyarsky
author & internet detective
Posts: 40211
816
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Gaurav Chikara:
Yeah all set of inserts are with in a same transaction
Therefore ideally shall be there any synchrnonization issues?


If they are in a properly configured transaction, this shouldn't be able to happen. What setting are you using for the transaction?
 
What are your superhero powers? Go ahead and try them on this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic