1 /* 2 * Enhydra Java Application Server Project 3 * 4 * The contents of this file are subject to the Enhydra Public License 5 * Version 1.1 (the "License"); you may not use this file except in 6 * compliance with the License. You may obtain a copy of the License on 7 * the Enhydra web site ( http://www.enhydra.org/ ). 8 * 9 * Software distributed under the License is distributed on an "AS IS" 10 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 11 * the License for the specific terms governing rights and limitations 12 * under the License. 13 * 14 * The Initial Developer of the Enhydra Application Server is Lutris 15 * Technologies, Inc. The Enhydra Application Server and portions created 16 * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc. 17 * All Rights Reserved. 18 * 19 * Contributor(s): 20 * 21 * $Id: DBRowUpdateException.java,v 1.1 2004/09/03 13:42:37 sinisa Exp $ 22 */ 23 package com.lutris.appserver.server.sql; 24 25 /** 26 * DBRowUpdateException is thrown when a CoreDO update fails. 27 * 28 * Two values are used to uniquely identify a row in a table: 29 * oId and version. 30 * The executeUpdate() method creates an SQL UPDATE command 31 * to write the new values in a CoreDO object back to 32 * the correct row in the database. 33 * The row is identifed by the oId and version values specified 34 * in the WHERE-clause of the UPDATE command. 35 * 36 * So, if no row has the specified oId and version combination, 37 * the UPDATE will fail, and report that 0 rows were updated. 38 * Note: other database problems (e.g. disk full) can also cause 39 * an UPDATE to fail, but these are rare. 40 * 41 * When versioning == true, the executeUpdate() method will increment 42 * the version number in both the CoreDO object and in the updated row. 43 * 44 * When the same oId/version combination is used twice to create 45 * two CoreDO objects (A and B) that refer to the same row, 46 * it is possible for the version number of one of those objects 47 * to become out-of-sync with the row in the database. 48 * Object A is updated, and the version number in object A and 49 * in the row is incremented. 50 * When an attempt is made to update object B, the version number in 51 * object B no longer matches the row in the database, 52 * so the row is not found, and the update has no effect 53 * (zero rows are updated). 54 * In this case, the CoreDO.executeUpdate() method throws 55 * a DBRowUpdateException describing the problem. 56 * 57 * The application code that catches this exception 58 * should probably reload the Data Object from the database. 59 * 60 * @version $Revision: 1.1 $ 61 * @see CoreDO 62 * @author Jay Gunter 63 */ 64 public class DBRowUpdateException extends java.sql.SQLException { 65 66 /** 67 * Construct a exception without a specified cause. 68 * 69 * @param msg The message associated with the exception. 70 */ 71 public DBRowUpdateException(String msg) { 72 super(msg); 73 } 74 } 75