You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-dev@db.apache.org by tf...@apache.org on 2012/10/16 23:27:42 UTC

svn commit: r1398996 - in /db/torque/torque4/trunk/torque-site/src/site: site.xml xdoc/documentation/modules/runtime/reference/exceptions.xml

Author: tfischer
Date: Tue Oct 16 21:27:42 2012
New Revision: 1398996

URL: http://svn.apache.org/viewvc?rev=1398996&view=rev
Log:
TORQUE-233 document exception translation

Added:
    db/torque/torque4/trunk/torque-site/src/site/xdoc/documentation/modules/runtime/reference/exceptions.xml
Modified:
    db/torque/torque4/trunk/torque-site/src/site/site.xml

Modified: db/torque/torque4/trunk/torque-site/src/site/site.xml
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-site/src/site/site.xml?rev=1398996&r1=1398995&r2=1398996&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-site/src/site/site.xml (original)
+++ db/torque/torque4/trunk/torque-site/src/site/site.xml Tue Oct 16 21:27:42 2012
@@ -151,6 +151,7 @@
             <item name="Multiple DBs"    href="/documentation/modules/runtime/reference/multiple-dbs.html"/>
             <item name="Managers and Cache" href="/documentation/modules/runtime/reference/managers-cache.html"/>
             <item name="Beans"           href="/documentation/modules/runtime/reference/beans.html"/>
+            <item name="Exceptions"      href="/documentation/modules/runtime/reference/exceptions.html"/>
             <item name="Relevant classes" href="/documentation/modules/runtime/reference/relevant-classes.html"/>
             <item name="Supporting a new DB" href="/documentation/modules/runtime/reference/new-database-support.html"/>
           </item>

Added: db/torque/torque4/trunk/torque-site/src/site/xdoc/documentation/modules/runtime/reference/exceptions.xml
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-site/src/site/xdoc/documentation/modules/runtime/reference/exceptions.xml?rev=1398996&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-site/src/site/xdoc/documentation/modules/runtime/reference/exceptions.xml (added)
+++ db/torque/torque4/trunk/torque-site/src/site/xdoc/documentation/modules/runtime/reference/exceptions.xml Tue Oct 16 21:27:42 2012
@@ -0,0 +1,78 @@
+<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+
+<document>
+
+ <properties>
+   <title>Torque Runtime Reference - Exception handling</title>
+ </properties>
+
+ <body>
+
+  <section name="Exception handling">
+  
+    <p>
+      Torque converts all Exceptions thrown by the Database into 
+      instances of <code>org.apache.torque.TorqueException</code>
+      or subclasses thereof. TorqueException is a checked exception.
+    </p>
+    <p>
+      Subclasses of TorqueException whcih are generated by database exceptions
+      are:
+    </p>
+    <ul>
+      <li>
+        <code>org.apache.torque.ConstraintViolationException</code>
+        - thrown whenever a write operation violates a unique key,
+        a not-null constraint or a foreign key constraint in the database.
+      </li>
+      <li>
+        <code>org.apache.torque.DeadlockEception</code>
+        - thrown whenever the database detects a deadlock between two
+        or more transaction which are executed simultaneously (Note: hsqldb
+        does not seem to be able to detect deadlocks as of version 2.2.8).
+      </li>
+    </ul>
+    <p>
+      All other database exceptions are mapped to TorqueException directly.
+    </p>
+    <p>
+      Torque also can throw TorqueExceptions or subclasses thereof 
+      without a database error, e.g. if a database is accessed via Torque 
+      when Torque is not initialized.
+      Subclasses of TorqueExceptions thrown in special situations are:
+    </p>
+    <ul>
+      <li>
+        <code>org.apache.torque.NoRowsException</code>
+        - thrown whenever a read operation expects to hit exactly one record
+        but does not hit one (e.g. the generated retrieveByPk methods 
+        in the generated peer classes). 
+      </li>
+      <li>
+        <code>org.apache.torque.TooManyRowsException</code>
+        - thrown whenever a read operation expects to hit at most one record
+        but does hit more than one (e.g. by the doSelectSingleRecord methods
+        in the peer classes). 
+      </li>
+    </ul>
+  </section>
+ </body>
+</document>



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org