• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

DB Transactions

 
Ben Parker
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I've been working on the database part of the SCJD and I was wondering whether anyone knows if it would be a good idea to try and implement support for transactions so that if an exception is thrown for any reason the changes will be rolled back. Would this be something that would be considered required or is it something that would lead to losing marks?

Thanks.

B.
 
Paul Bourdeaux
Ranch Hand
Posts: 783
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

First, you may want to change your name to comply with the JavaRanch Naming Policy, or you may attract the unwanted attention of a bartender or sheriff...

Second, I think that implementing transaction support is outside the scope of this project. It is not required, and it introduces complexity into the design. The more complex, the more likely you are to have a bug. Also, remember that the assignment expects junior developers to be able to maintain the code.

Hope that helped!
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 12007
215
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Paul (and B),

First, you may want to change your name to comply with the JavaRanch Naming Policy, or you may attract the unwanted attention of a bartender or sheriff...


Paul - thanks very much for helping with this. We really apreciate when other forum members make our life easier by helping in this way. However in this particular case, B is safe: There is a line in the naming convention that says "You can even use initials for the first name if you like." (In the category of information you probably don't want to know: I personally have a problem with calling a person "B", because I have spent far too much time watching Buffy the Vampire Slayer, and Faith always calls Buffy "B" )

I also agree that transaction handling is beyond the requirements of the assignment. For this assignment, there should only be a single operation in a transaction anyway, so there is nothing really to roll back.

Regards, Andrew
 
Ben Parker
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Thanks for your replies. In the case of the transactions, I was thinking that if, for example, an IOException was thrown when writing one of the fields of a record to the database, then the database file could then become corrupted and the application would no longer work properly.

Sounds like I don't have to worry about it though for the scope of the assignment

Thanks.

Ben.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic