Class JDOUtils


  • public final class JDOUtils
    extends java.lang.Object
    Common static methods for Castor JDO.
    Since:
    0.9.9.1
    Version:
    $Revision: 8111 $ $Date: 2006-05-24 08:49:08 -0600 (Wed, 24 May 2006) $
    Author:
    Ralf Joachim, Stein M. Hugubakken
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void closeConnection​(java.sql.Connection conn)
      Closes the Connection without throwing SQLException.
      static void closeDatabase​(Database db)
      Closes the Database without throwing exceptions.
      static void closeResultSet​(java.sql.ResultSet rs)
      Closes the ResultSet without throwing SQLException.
      static void closeStatement​(java.sql.Statement stmt)
      Closes the Statement without throwing SQLException.
      static ClassDescriptor getClassDescriptor​(java.lang.String db, java.lang.Class<?> type)
      Return ClassDescriptor for given type in named database .
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • closeConnection

        public static void closeConnection​(java.sql.Connection conn)
        Closes the Connection without throwing SQLException. A warning is added to the log if SQLException is thrown.
        Parameters:
        conn - The Connection to close
      • closeResultSet

        public static void closeResultSet​(java.sql.ResultSet rs)
        Closes the ResultSet without throwing SQLException. A warning is added to the log if SQLException is thrown.
        Parameters:
        rs - The ResultSet to close
      • closeStatement

        public static void closeStatement​(java.sql.Statement stmt)
        Closes the Statement without throwing SQLException. A warning is added to the log if SQLException is thrown.
        Parameters:
        stmt - The Statement to close
      • closeDatabase

        public static void closeDatabase​(Database db)
        Closes the Database without throwing exceptions. An active transaction will silently rolled back. Warnings are added to the log if any exception occures.
        Parameters:
        db - The database to close.
      • getClassDescriptor

        public static ClassDescriptor getClassDescriptor​(java.lang.String db,
                                                         java.lang.Class<?> type)
                                                  throws MappingException
        Return ClassDescriptor for given type in named database .
        Parameters:
        db - The database's name.
        type - The class.
        Returns:
        ClassDescriptor if exists, otherwise null.
        Throws:
        MappingException - If database can not be instantiated.