This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
I am alittle inexperienced when it comes to handling errors. I am using a try/catch which will log errors, I also have a return statement which will be used to inform the user if anything goes wrong. Do I need anything else ? I was told I should have a commit/rollback in there, but how to do implement it?
Transaction demarcation is a big topic. Handling and programming transactions can be done in many different ways. Basically, you want to identify what is a "transaction" in terms of your application. You would first need to get a good understanding of the definition of a "transaction."
Once you have identified the transaction, you then need to look at the operations of the transaction and which methods implement those operations.
Next, you need to look at how you have designed the business logic and the database logic and look at the business methods and the persistence methods.
Check out the Java Transaction API for more info. Below is an example for study:
[ December 02, 2008: Message edited by: James Clark ]
shaf maff
Ranch Hand
Joined: Sep 07, 2008
Posts: 180
posted
0
Thanks for the reply. I had a quick read of the api. How is this different from the way I have coded my one above ? It looks like this should only be used in transactions, I am not doing any so should I just stick to my code ?
Jimmy Clark
Ranch Hand
Joined: Apr 16, 2008
Posts: 2187
posted
0
Do you understand the definition of "transaction" ? [ December 02, 2008: Message edited by: James Clark ]
shaf maff
Ranch Hand
Joined: Sep 07, 2008
Posts: 180
posted
0
Well, its usually a transaction between parties. Its usually attributed to money, unless java means it in its more general way? :s
Jimmy Clark
Ranch Hand
Joined: Apr 16, 2008
Posts: 2187
posted
0
I suggest that you execute a Yahoo search on the term "database transaction demarcation." IBM and the Hibernate group have good material that covers transaction management and programming.
Enjoy!
shaf maff
Ranch Hand
Joined: Sep 07, 2008
Posts: 180
posted
0
I read up on the java website and it makes sense now. I have a question, in the code you posted, I wanted to know for the following line of code:
the exUpdate is my custom function which runs the sql statement right ?