-1

this is my second question.. i am programming a big inventory management system.. my code is working well i just want your advice is it a good idea to put setAutoCommit(false) in constructor & commit() in Ok button also rollback() in Cancel button?

hope you well guys and thanks for the advice.

Anti Atlas Dev
  • 416
  • 1
  • 4
  • 15

2 Answers2

0

yep it's very good because of the is any mistake in your statement you can rollback before mistake is happened

Sorry for my language weakness I try to learn

Ahmed Alzubaidi
  • 109
  • 1
  • 2
  • i am using a jTable to edit database directly from it and i have alot of SQL statements because of a big relationship... if that is bad because i did not find any other solution.. think about adding rows to an order detail the data should be save directly to database and it should not be committed until you call commit() with Ok button or call rollback() with cancel button.. i have a big database and i need to get data from somewhere to edit other data.. what you think guys? thanks and i am sorry too for my bad english :-/ – Anti Atlas Dev Jan 16 '16 at 22:21
  • You can add rows in the database and table without commit the statement Means (Doesn't save ) after you finish you can save the data using commit() method I use this before and its work fine – Ahmed Alzubaidi Jan 17 '16 at 10:30
0

after long time ago i want to answer this question myself:

to put setAutoCommit(false); in in constructor is not a good idea it is bad.. so the good way is to put it in a method and call that method in constructor with an event..

thanx

Anti Atlas Dev
  • 416
  • 1
  • 4
  • 15